Skip to content

Commit

Permalink
chore: reword vulnerability text and reference osvVulnerabilityAlerts
Browse files Browse the repository at this point in the history
  • Loading branch information
secustor committed May 16, 2023
1 parent 8da0435 commit 4589467
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/workers/repository/dependency-dashboard.spec.ts
Expand Up @@ -1052,7 +1052,7 @@ describe('workers/repository/dependency-dashboard', () => {
);
});

it('return all vulnerabilities if set to all', async () => {
it('return all vulnerabilities if set to all and disabled osvVulnerabilities', async () => {
const fetchVulnerabilitiesMock = jest.fn();
createVulnerabilitiesMock.mockResolvedValueOnce({
fetchVulnerabilities: fetchVulnerabilitiesMock,
Expand Down Expand Up @@ -1085,12 +1085,13 @@ describe('workers/repository/dependency-dashboard', () => {
{
...config,
dependencyDashboardOSVVulnerabilitySummary: 'all',
osvVulnerabilityAlerts: true,
},
packageFiles
);
expect(result.trimEnd()).toBe(codeBlock`## Vulnerabilities
\`1\` of a total of \`2\` CVEs have no fixes in this repository.
\`1\`/\`2\` CVEs have Renovate fixes.
<details><summary>npm</summary>
<blockquote>
Expand Down Expand Up @@ -1156,7 +1157,8 @@ describe('workers/repository/dependency-dashboard', () => {
);
expect(result.trimEnd()).toBe(codeBlock`## Vulnerabilities
\`1\` of a total of \`2\` CVEs have no fixes in this repository.
\`1\`/\`2\` CVEs have possible Renovate fixes.
See [\`osvVulnerabilityAlerts\`](https://docs.renovatebot.com/configuration-options/#osvvulnerabilityalerts) to allow Renovate to supply fixes.
<details><summary>npm</summary>
<blockquote>
Expand Down
10 changes: 9 additions & 1 deletion lib/workers/repository/dependency-dashboard.ts
Expand Up @@ -489,8 +489,16 @@ export async function getDashboardMarkdownVulnerabilities(
const unresolvedVulnerabilities = vulnerabilities.filter((value) =>
is.nullOrUndefined(value.fixedVersion)
);
const resolvedVulnerabilitiesLength =
vulnerabilities.length - unresolvedVulnerabilities.length;

result += `\`${unresolvedVulnerabilities.length}\` of a total of \`${vulnerabilities.length}\` CVEs have no fixes in this repository.\n`;
result += `\`${resolvedVulnerabilitiesLength}\`/\`${vulnerabilities.length}\``;
if (is.truthy(config.osvVulnerabilityAlerts)) {
result += ' CVEs have Renovate fixes.\n';
} else {
result +=
' CVEs have possible Renovate fixes.\nSee [`osvVulnerabilityAlerts`](https://docs.renovatebot.com/configuration-options/#osvvulnerabilityalerts) to allow Renovate to supply fixes.\n';
}

let renderedVulnerabilities: Vulnerability[];
switch (config.dependencyDashboardOSVVulnerabilitySummary) {
Expand Down

0 comments on commit 4589467

Please sign in to comment.