Skip to content

Commit

Permalink
refactor: vulnerability matchFiles (#8786)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Feb 20, 2021
1 parent e1ec04e commit 8c48d4b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Array [
],
"matchFiles": Array [
"backend/package-lock.json",
"backend/package.json",
],
"matchPackageNames": Array [
"electron",
Expand Down
16 changes: 0 additions & 16 deletions lib/workers/repository/init/vulnerability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { logger } from '../../../logger';
import { platform } from '../../../platform';
import { SecurityAdvisory } from '../../../types';
import { sanitizeMarkdown } from '../../../util/markdown';
import { regEx } from '../../../util/regex';
import * as allVersioning from '../../../versioning';
import * as mavenVersioning from '../../../versioning/maven';
import * as npmVersioning from '../../../versioning/npm';
Expand Down Expand Up @@ -184,21 +183,6 @@ export async function detectVulnerabilityAlerts(
},
};
matchRule.matchFiles = [fileName];
// The following list based off https://docs.github.com/en/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems
const lockToPackageFile = {
'package-lock.json': 'package.json',
'composer.lock': 'composer.json',
'pipfile.lock': 'Pipfile',
'Gemfile.lock': 'Gemfile',
'yarn.lock': 'package.json',
};
for (const [lock, packageFile] of Object.entries(lockToPackageFile)) {
if (fileName.endsWith(lock)) {
matchRule.matchFiles.push(
fileName.replace(regEx(`${lock}$`), packageFile)
);
}
}
alertPackageRules.push(matchRule);
}
}
Expand Down

0 comments on commit 8c48d4b

Please sign in to comment.