Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] spike: grouped remediation request and TS type #581

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/snyk-test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports.assembleQueryString = function (options) {
qs.severityThreshold = options.severityThreshold;
}

if (options['grouped-remediation']) {
qs.groupedRemediation = 1;
}

return Object.keys(qs).length !== 0 ? qs : null;
};

Expand Down
21 changes: 21 additions & 0 deletions src/lib/snyk-test/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ interface TestDepGraphResult {
binariesVulns?: TestDepGraphResult;
baseImage?: any;
};
remediationRec?: RemediationResult; // only present when options['grouped-remediation']
}

interface RemediationResult {
unresolved: IssueData[];
upgrade: {[pkg: string]: { // pkg@version
upgradeTo: string; // pkg@version
upgrades: string[]; // pkg@version
vulns: string[]; // pkg@version
}};
// below: path is "pkg1 > pkg2 > pkg3"
patch: {[vulnId: string]: {
paths: Array<{ // Always array of 1 object?
[path: string]: {patched: Date;}
}>,
}};
ignore: {[vulnId: string]: {
paths: Array<{ // Always array of 1 object?
[path: string]: {reason: string; expires: Date;}
}>,
}};
}

interface TestDepGraphMeta {
Expand Down