Vulnerabilities strategies
NodeSecure vulnerabilities strategies built for NodeSecure scanner.
Requirements
Getting Started
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @nodesecure/vuln
$ yarn add @nodesecure/vuln
Usage example
import * as vuln from "@nodesecure/vuln";
await vuln.setStrategy(vuln.strategies.NPM_AUDIT);
const definition = await vuln.getStrategy();
console.log(definition.strategy);
await definition.hydratePayloadDependencies(new Map());
Available strategy
Those strategies are described as "string" type with the following TypeScript definition:
type Kind = "npm" | "node";
API
See types/api.d.ts
for a complete TypeScript definition.
function setStrategy(name?: Strategy.Kind, options?: Strategy.Options): Promise<Strategy.Definition>;
function getStrategy(): Promise<Strategy.Definition>;
const strategies: {
SECURITY_WG: "node";
NPM_AUDIT: "npm";
};
Strategy Kind
and Options
are described by the following interfaces:
export interface Options {
hydrateDatabase?: boolean;
}
export interface Definition {
strategy: Kind;
hydratePayloadDependencies: (dependencies: Dependencies) => Promise<void>;
hydrateDatabase?: () => Promise<void>;
deleteDatabase?: () => Promise<void>;
}
Where dependencies
is the dependencies Map() object of the scanner.
Note: the option hydrateDatabase is only useful for some of the strategy (like Node.js Security WG).
License
MIT