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.
@restorecommerce/gql-bot
Advanced tools
This is an automated GraphQL API client.
Example use cases:
Supported data format: YAML
.
The jobs are defined as JSON files whose syntax can be seen in a test job.
The module mainly consists of two usable components.
A wrapper around graphql-request. It is used to connect to a GraphQL endpoint with custom headers, further prepare the mutation parameters based on job specifications and parsed resources, and for making the mutations/queries requests. Such resources are described in a YAML file, and they are initially parsed by the Job Processor before handing them to the Client.
The job processor implements a pipeline mechanism to process JSON-based job files, which can contain one or more tasks, which can be run concurrently or sequentially. The job can have different options such as the maximum number of concurrent tasks and each task contains useful information for the GraphQL Client, such as the file path filter (e.g: 'create*.yaml'), the desired operation, batching, or useful metadata. Currently, the only implemented operation is 'sync'. There is a GraphQL-based processor, which performs calls to the GraphQL client and a generic processor, to which the GraphQL-specific processor is provided.
After reading the resources from the .yaml
file, splitting of documents is done
in streaming fashion, using
yaml-document-stream,
(which internally uses js-yaml
for single document parsing), and then gathered
into a single payload or optionally batched if the property batchSize
is
provided inside the job's task properties. This way, a larger amount of data can
be imported as-well, by making subsequent GraphQL requests.
Example:
import { GraphQLProcessor, JobProcessor, Job } from 'gql-bot';
const jobInfo = JSON.parse(fs.readFileSync('./test/job1.json', 'utf8'));
// instantiating a job processor
jobInfo.options.processor = new GraphQLProcessor({
entry: 'http://example.com/graphql',
apiKey: 'apiKey'
});
const jobProcessor = new JobProcessor(jobInfo);
// starting a job
const job = new Job(); // an extension of EventEmitter which can receive job-related options
job.on('progress', (task) => {
console.log('Progress:', task.name, task.progress);
});
job.on('done', () => {
done();
});
await jobProcessor.start(jobInfo, job);
Refer to tests for more details.
The following events are issued by the Job
object:
progress
(contains info specific with the task progress percentage and the task's description)warn
error
done
FAQs
GraphQL Client Automated Task Processor
The npm package @restorecommerce/gql-bot receives a total of 3 weekly downloads. As such, @restorecommerce/gql-bot popularity was classified as not popular.
We found that @restorecommerce/gql-bot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.