Skip to content

Commit

Permalink
fix(vulnerabilities): set matchCurrentVersion for github alerts (#31612)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored Sep 25, 2024
1 parent f96ecc1 commit b2e2b0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exports[`workers/repository/init/vulnerability detectVulnerabilityAlerts() retur
"vulnerabilityFixStrategy": "lowest",
},
"isVulnerabilityAlert": true,
"matchCurrentVersion": "< 1.8.3",
"matchDatasources": [
"go",
],
Expand Down Expand Up @@ -50,6 +51,7 @@ exports[`workers/repository/init/vulnerability detectVulnerabilityAlerts() retur
"vulnerabilityFixStrategy": "lowest",
},
"isVulnerabilityAlert": true,
"matchCurrentVersion": "(,2.7.9.4)",
"matchDatasources": [
"maven",
],
Expand Down Expand Up @@ -85,6 +87,7 @@ exports[`workers/repository/init/vulnerability detectVulnerabilityAlerts() retur
"vulnerabilityFixStrategy": "lowest",
},
"isVulnerabilityAlert": true,
"matchCurrentVersion": "< 2.2.1.0",
"matchDatasources": [
"pypi",
],
Expand Down
6 changes: 6 additions & 0 deletions lib/workers/repository/init/vulnerability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,15 @@ export async function detectVulnerabilityAlerts(
matchFileNames,
};

let matchCurrentVersion = `< ${val.firstPatchedVersion}`;
if (datasource === MavenDatasource.id) {
matchCurrentVersion = `(,${val.firstPatchedVersion})`;
}

// Remediate only direct dependencies
matchRule = {
...matchRule,
matchCurrentVersion,
vulnerabilityFixVersion: val.firstPatchedVersion,
prBodyNotes,
isVulnerabilityAlert: true,
Expand Down

0 comments on commit b2e2b0d

Please sign in to comment.