
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
@snyk/code-client
Advanced tools
Typescript consumer of public API
$ npm install --save @snyk/code-client
import codeClient from '@snyk/code-client';
// An address of server which will be used in order to send code and analyse it.
const baseURL = 'https://www.snyk.io';
const loginResponse = await codeClient.startSession({
baseURL,
// An identificator for the editor using the Snyk APIs
source: 'atom',
});
if (loginResponse.type === 'error') {
// Handle error and alert user
}
const { sessionToken, loginURL } = loginResponse.value;
const sessionResponse = await codeClient.checkSession({ baseURL, sessionToken });
if (sessionResponse.type === 'error') {
// Handle error and alert user
}
const isLoggedIn = sessionResponse.value; // boolean
/** Building bundle process started with provided data */
codeClient.emitter.on('scanFilesProgress', (processed: number) = {
console.log(`Indexed ${processed} files`);
});
/** Bundle upload process is started with provided data */
codeClient.emitter.on('uploadBundleProgress', (processed: number, total: number) => {
console.log(`Upload bundle progress: ${processed}/${total}`);
});
/** Receives an error object and logs an error message */
codeClient.emitter.on('sendError', error => {
console.log(error);
});
/** Logs HTTP requests sent to the API **/
codeClient.emitter.on('apiRequestLog', (message) => {
console.log(message);
});
Complete list of events:
const bundle = await codeClient.analyzeFolders({
baseURL,
sessionToken,
includeLint: false,
severity: 1,
paths: ['/home/user/repo'],
sarif,
source,
});
// bundle implements interface IFileBundle:
// readonly baseURL: string;
// readonly sessionToken: string;
// readonly includeLint: boolean;
// readonly severity: AnalysisSeverity;
// readonly bundleId: string;
// readonly analysisResults: IAnalysisResult;
// readonly analysisURL: string;
// readonly baseDir: string;
// readonly paths: string[];
// readonly supportedFiles: ISupportedFiles;
const result = await codeClient.extendBundle({
sessionToken,
bundleId,
files: {
'/home/user/repo/main.js': '3e297985...',
'/home/user/repo/app.js': 'c8bc6452...',
},
removedFiles: [],
});
const { bundleId, missingFiles, uploadURL } = result;
const bundle = await analyzeGit({
baseURL,
sessionToken,
includeLint: false,
severity: 1,
gitUri: 'git@github.com:DeepCodeAI/cli.git@320d98a6896f5376efe6cefefb6e70b46b97d566',
sarif: true,
source,
});
// bundle implements interface IGitBundle
// readonly baseURL: string;
// readonly sessionToken: string;
// readonly oAuthToken?: string;
// readonly includeLint: boolean;
// readonly severity: AnalysisSeverity;
// readonly bundleId: string;
// readonly analysisResults: IAnalysisResult;
// readonly analysisURL: string;
// readonly sarifResults?: Log;
// readonly gitUri: string;
If there are any errors the result of every call will contain the following:
const { error, statusCode, statusText } = result;
FAQs
Typescript consumer of SnykCode public API
The npm package @snyk/code-client receives a total of 5,466 weekly downloads. As such, @snyk/code-client popularity was classified as popular.
We found that @snyk/code-client demonstrated a healthy version release cadence and project activity because the last version was released less than 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 researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.