Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Using Solr from JavaScript clients may be straightforward but Solr uses shorthand url parameters to specify your desires which tend to lead to hard to read search logic in your application quickly. We were in desperate need of a TypeScript library that:
The library follows a prepare-execute pattern: you first specify different parts of the desired operation and then execute it. During execution the library will transform your input to an actual Solr url, post it to Solr and return Solr's response as a json object. You are on your own interpreting that response.
The examples intentionally left out error handling.
import { SolrClient } from 'solrts';
const solrConfigSetOperation = new SolrClient(8.5).configsetOperation;
solrConfigSetOperation.prepareUpload(NameThatConfigsetShouldHaveInSolr, NameOfZipFileThatContainsConfigset);
await solrConfigSetOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
You can find more examples in the unit tests (configset.spec.ts)
import { SolrClient } from 'solrts';
const solrCollectionOperation = new SolrClient(8.5).collectionOperation;
solrCollectionOperation.numShards(1).prepareCreate(NameThatCollectionShouldHaveInSolr, NameOfConfigsetThatShouldBeUsedForCollection);
await solrCollectionOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
You can find more examples in the unit tests (collection.spec.ts)
import { SolrClient } from 'solrts';
const solrAliasOperation = new SolrClient(8.5).aliasOperation;
solrAliasOperation.prepareCreate(NameOfTheAliasThatYouWantYourCollectionToBeExposedUnder), ArrayWithOneOrMoreCollectionsThatShouldBeExposedUnderTheAliasname);
await solrAliasOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
You can find more examples in the unit tests (alias.spec.ts)
import { SolrClient } from 'solrts';
const solrIndexOperation = new SolrClient(8.5).indexOperation;
solrIndexOperation.in('AnExistingCollection').prepareBulk(ArrayOfObjectsThatContainPropertiesThatCorrespondToTheSchema, []);
await solrIndexOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
import { SolrClient } from 'solrts';
const solrIndexOperation = new SolrClient(8.5).indexOperation;
solrIndexOperation.in('AnExistingCollection').prepareBulk([], ArrayOfObjectsThatContainTheIdOfDocumentsThatShouldBeDeleted);
await solrIndexOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
You can find more examples in the unit tests (index.spec.ts)
import { SolrClient } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation.in('AnExistingCollection');
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
import { SolrClient } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation
.for(new LuceneQuery().term('OneOrMoreSearchTerms')
.in('AnExistingCollection');
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
import { SolrClient } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation
.for(new LuceneQuery().term('OneOrMoreSearchTerms').in('SpecificField'))
.in('AnExistingCollection');
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
import { SolrClient } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation
.limit(MaxNumberOfResults)
.offset(StartingFromResult)
.in('AnExistingCollection');
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
import { SolrClient, SearchFilter } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation
.in('AnExistingCollection')
.filter(new SearchFilter(FieldNameYouWantToFilterOn).equals(ValueThatAllDocumentsInResponseShouldHaveForThisField))
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
import { SolrClient, SearchFilter } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation
.in('AnExistingCollection')
.filter(new SearchFilter(FieldNameYouWantToFilterOn).ors(ArrayOfValuesOfWhichAllDocumentsInResponseShouldContainAtLeastOnOfForThisField))
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
import { SolrClient, SearchFilter } from 'solrts';
const solrSearchOperation = new SolrClient(8.5).searchOperation;
solrSearchOperation
.in('AnExistingCollection')
.filter(new SearchFilter(FieldNameYouWantToFilterOn).from(FromValue).to(ToValue))
const solrAnswer: any = await solrSearchOperation.execute(IpOrHostnameOfASolrNode, PortNumberWhereThatSolrNodeListensOn);
if (solrAnswer && solrAnswer.response && solrAnswer.response.docs) {
// do something with the docs
}
You can find more search examples in the unit tests (search.spec.ts)
View the queries that are being made by setting the env parameter DEBUG.
Shell:
DEBUG=solrts:* node YourScript
DOS:
set DEBUG=soltrs:* & node YourScript
FAQs
A TypeScript client for Solr
The npm package solrts receives a total of 1 weekly downloads. As such, solrts popularity was classified as not popular.
We found that solrts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.