123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- import * as depGraphLib from '@snyk/dep-graph';
- import { DepsFilePaths, ScanResult, FileSignaturesDetails } from '../ecosystems/types';
- import { SupportedPackageManagers } from '../package-managers';
- import { Options, SupportedProjectTypes, TestOptions } from '../types';
- interface Pkg {
- name: string;
- version?: string;
- }
- interface Patch {
- version: string;
- id: string;
- urls: string[];
- modificationTime: string;
- }
- export declare enum SEVERITY {
- LOW = "low",
- MEDIUM = "medium",
- HIGH = "high",
- CRITICAL = "critical"
- }
- export interface VulnMetaData {
- id: string;
- title: string;
- description: string;
- type: 'license' | 'vuln';
- name: string;
- info: string;
- severity: SEVERITY;
- severityValue: number;
- isNew: boolean;
- version: string;
- packageManager: SupportedPackageManagers | 'upstream';
- }
- export interface GroupedVuln {
- list: AnnotatedIssue[];
- metadata: VulnMetaData;
- isIgnored: boolean;
- title: string;
- note: string | false;
- severity: SEVERITY;
- originalSeverity?: SEVERITY;
- isNew: boolean;
- name: string;
- version: string;
- isFixable: boolean;
- fixedIn: string[];
- legalInstructionsArray?: LegalInstruction[];
- }
- export interface LegalInstruction {
- licenseName: string;
- legalContent: string;
- }
- export interface IssueData {
- id: string;
- packageName: string;
- version: string;
- moduleName?: string;
- below: string;
- semver: {
- vulnerable: string | string[];
- vulnerableHashes?: string[];
- vulnerableByDistro?: {
- [distroNameAndVersion: string]: string[];
- };
- };
- patches: Patch[];
- isNew: boolean;
- description: string;
- title: string;
- severity: SEVERITY;
- fixedIn: string[];
- legalInstructions?: string;
- packageManager?: SupportedProjectTypes;
- from?: string[];
- name?: string;
- }
- export declare type CallPath = string[];
- interface AnnotatedIssue extends IssueData {
- credit: string[];
- name: string;
- version: string;
- from: string[];
- upgradePath: Array<string | boolean>;
- isUpgradable: boolean;
- isPatchable: boolean;
- severity: SEVERITY;
- originalSeverity?: SEVERITY;
- bundled?: any;
- shrinkwrap?: any;
- __filename?: string;
- parentDepType: string;
- type?: 'license';
- title: string;
- patch?: any;
- note?: string | false;
- publicationTime?: string;
- identifiers?: {
- [name: string]: string[];
- };
- }
- export interface DockerIssue {
- nearestFixedInVersion?: string;
- dockerfileInstruction?: any;
- dockerBaseImage?: any;
- }
- export interface IgnoreSettings {
- adminOnly: boolean;
- reasonRequired: boolean;
- disregardFilesystemIgnores: boolean;
- }
- export interface BasicResultData {
- ok: boolean;
- payloadType?: string;
- org: string;
- isPrivate: boolean;
- summary: string;
- packageManager?: SupportedProjectTypes;
- severityThreshold?: string;
- platform?: string;
- }
- export interface LegacyVulnApiResult extends BasicResultData {
- vulnerabilities: AnnotatedIssue[];
- dependencyCount: number;
- policy: string;
- licensesPolicy: object | null;
- ignoreSettings: IgnoreSettings | null;
- docker?: {
- baseImage?: any;
- binariesVulns?: unknown;
- baseImageRemediation?: BaseImageRemediation;
- };
- projectId?: string;
- filesystemPolicy?: boolean;
- uniqueCount?: any;
- remediation?: RemediationChanges;
- }
- export interface BaseImageRemediation {
- code: string;
- advice: BaseImageRemediationAdvice[];
- message?: string;
- }
- export interface BaseImageRemediationAdvice {
- message: string;
- bold?: boolean;
- color?: string;
- }
- export interface TestResult extends LegacyVulnApiResult {
- targetFile?: string;
- projectName?: string;
- targetFilePath?: string;
- displayTargetFile?: string;
- foundProjectCount?: number;
- scanResult?: ScanResult;
- }
- interface UpgradePathItem {
- name: string;
- version: string;
- newVersion?: string;
- isDropped?: boolean;
- }
- interface UpgradePath {
- path: UpgradePathItem[];
- }
- interface FixInfo {
- upgradePaths: UpgradePath[];
- isPatchable: boolean;
- nearestFixedInVersion?: string;
- }
- export interface AffectedPackages {
- [pkgId: string]: {
- pkg: Pkg;
- issues: {
- [issueId: string]: Issue;
- };
- };
- }
- interface TestDepGraphResult {
- issuesData: {
- [issueId: string]: IssueData;
- };
- affectedPkgs: AffectedPackages;
- docker: {
- binariesVulns?: TestDepGraphResult;
- baseImage?: any;
- };
- remediation?: RemediationChanges;
- }
- export interface Issue {
- pkgName: string;
- pkgVersion?: string;
- issueId: string;
- fixInfo: FixInfo;
- }
- export interface TestDependenciesResult {
- issuesData: {
- [issueId: string]: IssueData;
- };
- issues: Issue[];
- docker?: {
- baseImage: string;
- baseImageRemediation: BaseImageRemediation;
- binariesVulns: TestDepGraphResult;
- };
- remediation?: RemediationChanges;
- depsFilePaths?: DepsFilePaths;
- depGraphData: depGraphLib.DepGraphData;
- fileSignaturesDetails: FileSignaturesDetails;
- vulnerabilities: IssueData[];
- path: string;
- dependencyCount: number;
- packageManager: SupportedProjectTypes;
- }
- export interface TestDepGraphMeta {
- isPublic: boolean;
- isLicensesEnabled: boolean;
- licensesPolicy?: {
- severities: {
- [type: string]: string;
- };
- };
- projectId?: string;
- ignoreSettings?: IgnoreSettings;
- policy: string;
- org: string;
- }
- export interface TestDepGraphResponse {
- result: TestDepGraphResult;
- meta: TestDepGraphMeta;
- }
- export interface TestDependenciesResponse {
- result: TestDependenciesResult;
- meta: TestDepGraphMeta;
- }
- export interface Ignores {
- [path: string]: {
- paths: string[][];
- meta: {
- days?: number;
- reason?: string;
- };
- };
- }
- export interface PatchObject {
- [name: string]: {
- patched: string;
- };
- }
- export interface Upgrade {
- upgradeTo: string;
- }
- export interface UpgradeVulns extends Upgrade {
- vulns: string[];
- }
- export interface UpgradeRemediation extends UpgradeVulns {
- upgrades: string[];
- }
- export interface PatchRemediation {
- paths: PatchObject[];
- }
- export interface DependencyUpdates {
- [from: string]: UpgradeRemediation;
- }
- export interface PinRemediation extends UpgradeVulns {
- isTransitive: boolean;
- }
- export interface DependencyPins {
- [name: string]: PinRemediation;
- }
- export interface RemediationChanges {
- unresolved: IssueData[];
- upgrade: DependencyUpdates;
- patch: {
- [name: string]: PatchRemediation;
- };
- ignore: unknown;
- pin: DependencyPins;
- }
- declare function convertTestDepGraphResultToLegacy(res: TestDepGraphResponse, depGraph: depGraphLib.DepGraph, packageManager: SupportedProjectTypes | undefined, options: Options & TestOptions): LegacyVulnApiResult;
- export { convertTestDepGraphResultToLegacy, AnnotatedIssue };
|