cve-lite-cli 1.40.0 → 1.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +17 -11
  2. package/dist/advisory/local-advisory-source.js +9 -5
  3. package/dist/advisory/local-db.js +91 -13
  4. package/dist/advisory/osv-sync.js +187 -56
  5. package/dist/advisory/staging-directory.js +112 -0
  6. package/dist/cli/advisories-sync.js +16 -2
  7. package/dist/cli/args.js +46 -35
  8. package/dist/cli/config.js +4 -1
  9. package/dist/cli/help.js +4 -3
  10. package/dist/cli/validate.js +23 -1
  11. package/dist/constants.js +11 -25
  12. package/dist/index.js +8 -3
  13. package/dist/output/cyclonedx.js +23 -14
  14. package/dist/output/debug.js +68 -18
  15. package/dist/output/formatters.js +33 -5
  16. package/dist/output/html-reporter.js +55 -5
  17. package/dist/output/multi-folder-html-reporter.js +59 -3
  18. package/dist/output/output-dir.js +193 -7
  19. package/dist/output/printers.js +16 -5
  20. package/dist/output/sarif.js +131 -48
  21. package/dist/output/sbom-dependency-edges.js +16 -10
  22. package/dist/output/sbom-file.js +14 -6
  23. package/dist/output/scan-json.js +21 -3
  24. package/dist/output/spdx.js +61 -23
  25. package/dist/output/spinner.js +2 -1
  26. package/dist/output/write-outputs.js +142 -52
  27. package/dist/overrides/context-builder.js +23 -70
  28. package/dist/parsers/bun-lock.js +1 -2
  29. package/dist/parsers/index.js +22 -1
  30. package/dist/parsers/npm-lock-graph.js +39 -1
  31. package/dist/parsers/package-lock.js +25 -5
  32. package/dist/parsers/pnpm-lock.js +3 -2
  33. package/dist/parsers/utils.js +5 -3
  34. package/dist/parsers/yarn-lock-graph.js +5 -2
  35. package/dist/parsers/yarn-lock.js +1 -2
  36. package/dist/remediation/fix-commands.js +105 -44
  37. package/dist/remediation/npm-transitive-graph.js +30 -72
  38. package/dist/remediation/npm-transitive-resolution.js +24 -77
  39. package/dist/remediation/parent-upgrade-blockers.js +51 -0
  40. package/dist/remediation/parent-upgrade.js +5 -79
  41. package/dist/remediation/registry-parent-ranges.js +21 -0
  42. package/dist/remediation/transitive-chain-resolver.js +3 -3
  43. package/dist/scan/completeness.js +10 -4
  44. package/dist/scan/multi-folder-scan.js +133 -58
  45. package/dist/scan/single-scan.js +41 -25
  46. package/dist/scanner.js +257 -58
  47. package/dist/usage/scanner.js +19 -8
  48. package/dist/utils/array.js +11 -3
  49. package/dist/utils/debug-bundle.js +118 -0
  50. package/dist/utils/debug-project.js +102 -0
  51. package/dist/utils/debug-redaction.js +117 -0
  52. package/dist/utils/file.js +2 -1
  53. package/dist/utils/fix-runner.js +95 -13
  54. package/dist/utils/import-type-queries.js +322 -0
  55. package/dist/utils/network.js +13 -9
  56. package/dist/utils/npm-lockfile.js +12 -0
  57. package/dist/utils/osv-fetch.js +70 -0
  58. package/dist/utils/package-identity.js +43 -0
  59. package/dist/utils/package-manager-source.js +24 -0
  60. package/dist/utils/purl.js +37 -0
  61. package/dist/utils/registry-config.js +1 -16
  62. package/dist/utils/string.js +8 -0
  63. package/dist/utils/validate-url.js +1 -1
  64. package/dist/utils/version.js +30 -7
  65. package/dist/utils/versions/osv-range.js +191 -0
  66. package/dist/utils/versions/pep440.js +246 -0
  67. package/dist/utils/versions/scheme.js +10 -0
  68. package/package.json +3 -2
@@ -1,6 +1,7 @@
1
- import { compareVersions, isPreReleaseVersion, looksLikeVersion } from "../utils/version.js";
1
+ import { compareVersions, isPreReleaseVersion, looksLikeVersion, satisfiesRange } from "../utils/version.js";
2
2
  import { fetchPackument } from "./npm-registry.js";
3
3
  import { findSafeVersionWithinParentRange } from "./npm-transitive-graph.js";
4
+ import { registryParentRanges } from "./registry-parent-ranges.js";
4
5
  import { findPackageAlongPath } from "./package-path-lookup.js";
5
6
  import { resolveDirectParentContext } from "./parent-candidate-resolver.js";
6
7
  export async function resolveTransitiveRemediationViaRegistry(args) {
@@ -28,6 +29,7 @@ export async function resolveTransitiveRemediationViaRegistry(args) {
28
29
  viaPath,
29
30
  packages: args.packages,
30
31
  workspaceMap: args.workspaceMap,
32
+ parentGraph: args.parentGraph,
31
33
  });
32
34
  }
33
35
  if (!looksLikeVersion(directParent.version))
@@ -41,9 +43,13 @@ export async function resolveTransitiveRemediationViaRegistry(args) {
41
43
  parentManifest?.optionalDependencies?.[vulnerableName];
42
44
  if (!depRange)
43
45
  return null;
46
+ const ranges = [
47
+ depRange,
48
+ ...(await registryRangesFromEveryParent(args.parentGraph, vulnerableName, args.finding.pkg.version)),
49
+ ];
44
50
  const inRangeTarget = [...safeCandidates]
45
51
  .sort(compareVersions)
46
- .filter(v => versionSatisfiesRange(v, depRange))
52
+ .filter(v => ranges.every(range => satisfiesRange(v, range)))
47
53
  .at(-1);
48
54
  if (!inRangeTarget)
49
55
  return null;
@@ -108,6 +114,7 @@ export async function resolveNpmTransitiveRemediation(args) {
108
114
  parentNodeId,
109
115
  childName: vulnerableName,
110
116
  candidates: safeCandidates,
117
+ childVersion: args.finding.pkg.version,
111
118
  });
112
119
  if (inRangeTarget) {
113
120
  const workspaces = collectWorkspacesFromAllPaths(args.finding.dependencyPaths ?? [], args.workspaceMap);
@@ -141,7 +148,7 @@ export async function resolveNpmTransitiveRemediation(args) {
141
148
  const targetChildVersion = highestVersionSatisfyingRange(safeCandidates, depRange);
142
149
  if (!targetChildVersion)
143
150
  continue;
144
- const stillAllowsInstalled = versionSatisfiesRange(args.finding.pkg.version, depRange);
151
+ const stillAllowsInstalled = satisfiesRange(args.finding.pkg.version, depRange);
145
152
  if (stillAllowsInstalled && compareVersions(targetChildVersion, args.finding.pkg.version) <= 0) {
146
153
  continue;
147
154
  }
@@ -207,81 +214,9 @@ function resolveParentNodeId(args) {
207
214
  return candidateNodeIds[0] ?? null;
208
215
  }
209
216
  export function highestVersionSatisfyingRange(candidates, rawRange) {
210
- const matches = candidates.filter(candidate => versionSatisfiesRange(candidate, rawRange)).sort(compareVersions);
217
+ const matches = candidates.filter(candidate => satisfiesRange(candidate, rawRange)).sort(compareVersions);
211
218
  return matches.at(-1) ?? null;
212
219
  }
213
- export function versionSatisfiesRange(version, rawRange) {
214
- const range = rawRange.trim();
215
- if (!range)
216
- return false;
217
- if (range === "*" || range === "latest")
218
- return true;
219
- const orParts = range.split("||").map(part => part.trim()).filter(Boolean);
220
- return orParts.some(part => satisfiesAndRange(version, part));
221
- }
222
- function satisfiesAndRange(version, range) {
223
- const normalized = normalizeRange(range);
224
- if (!normalized)
225
- return false;
226
- const tokens = normalized.split(/\s+/).filter(Boolean);
227
- return tokens.every(token => satisfiesComparator(version, token));
228
- }
229
- function normalizeRange(range) {
230
- const trimmed = range.trim();
231
- if (!trimmed)
232
- return null;
233
- if (looksLikeVersion(trimmed)) {
234
- return `=${trimmed}`;
235
- }
236
- if (trimmed.startsWith("^")) {
237
- const base = trimmed.slice(1);
238
- if (!looksLikeVersion(base))
239
- return null;
240
- const [major, minor, patch] = parseCoreVersion(base);
241
- if (major > 0)
242
- return `>=${base} <${major + 1}.0.0`;
243
- if (minor > 0)
244
- return `>=${base} <0.${minor + 1}.0`;
245
- return `>=${base} <0.0.${patch + 1}`;
246
- }
247
- if (trimmed.startsWith("~")) {
248
- const base = trimmed.slice(1);
249
- if (!looksLikeVersion(base))
250
- return null;
251
- const [major, minor] = parseCoreVersion(base);
252
- return `>=${base} <${major}.${minor + 1}.0`;
253
- }
254
- return trimmed;
255
- }
256
- function satisfiesComparator(version, comparator) {
257
- const token = comparator.trim();
258
- if (!token)
259
- return true;
260
- const match = token.match(/^(<=|>=|<|>|=)?\s*([0-9]+\.[0-9]+\.[0-9]+(?:[-+][^\s]+)?)$/);
261
- if (!match)
262
- return false;
263
- const operator = match[1] ?? "=";
264
- const target = match[2];
265
- const cmp = compareVersions(version, target);
266
- switch (operator) {
267
- case "<":
268
- return cmp < 0;
269
- case "<=":
270
- return cmp <= 0;
271
- case ">":
272
- return cmp > 0;
273
- case ">=":
274
- return cmp >= 0;
275
- case "=":
276
- return cmp === 0;
277
- default:
278
- return false;
279
- }
280
- }
281
- function parseCoreVersion(version) {
282
- const [major = "0", minor = "0", patch = "0"] = version.split(/[+-]/)[0].split(".");
283
- return [Number(major), Number(minor), Number(patch)];
284
- }
285
220
  async function resolveWithinRangeForDeepChainViaRegistry(args) {
286
221
  const immediateParentPathPrefix = args.viaPath.slice(0, -1);
287
222
  const immediateParent = findPackageAlongPath(args.packages, args.immediateParentName, immediateParentPathPrefix);
@@ -296,9 +231,13 @@ async function resolveWithinRangeForDeepChainViaRegistry(args) {
296
231
  parentManifest?.optionalDependencies?.[args.vulnerableName];
297
232
  if (!depRange)
298
233
  return null;
234
+ const ranges = [
235
+ depRange,
236
+ ...(await registryRangesFromEveryParent(args.parentGraph, args.vulnerableName, args.installedVersion)),
237
+ ];
299
238
  const inRangeTarget = [...safeCandidates]
300
239
  .sort(compareVersions)
301
- .filter(version => versionSatisfiesRange(version, depRange))
240
+ .filter(version => ranges.every(range => satisfiesRange(version, range)))
302
241
  .at(-1);
303
242
  if (!inRangeTarget)
304
243
  return null;
@@ -332,6 +271,7 @@ async function resolveWithinRangeForDeepChain(args) {
332
271
  parentNodeId: nodeId,
333
272
  childName: args.vulnerableName,
334
273
  candidates: safeCandidates,
274
+ childVersion: args.installedVersion,
335
275
  });
336
276
  if (inRangeTarget) {
337
277
  return {
@@ -346,6 +286,13 @@ async function resolveWithinRangeForDeepChain(args) {
346
286
  }
347
287
  return null;
348
288
  }
289
+ // The range each parent of the installed copy declares for it, read from that
290
+ // parent's published manifest. A parent the registry cannot describe, such as a
291
+ // workspace member, is skipped, which leaves the chosen parent's range in force.
292
+ async function registryRangesFromEveryParent(graph, childName, childVersion) {
293
+ const parents = await registryParentRanges(graph, childName, childVersion);
294
+ return parents.map(parent => parent.range).filter((range) => range !== null);
295
+ }
349
296
  function collectWorkspacesFromAllPaths(dependencyPaths, workspaceMap) {
350
297
  if (!workspaceMap)
351
298
  return undefined;
@@ -0,0 +1,51 @@
1
+ import { isValidRange, looksLikeVersion, satisfiesRange } from "../utils/version.js";
2
+ import { registryParentRanges } from "./registry-parent-ranges.js";
3
+ // Only the project's own copies count: a package declared by the root or by a
4
+ // workspace member. Nothing else moves them, so the copy they hold stays put. A
5
+ // transitive holder, even one sharing a direct dependency's name, is often
6
+ // re-resolved along with the upgraded parent, so naming it would claim a block
7
+ // that may not exist (#1457).
8
+ export async function findParentUpgradeBlockers(args) {
9
+ if (!looksLikeVersion(args.targetChildVersion))
10
+ return [];
11
+ const holders = args.npmGraph
12
+ ? npmHolders(args.npmGraph, args.childName, args.childVersion)
13
+ : await registryParentRanges(args.lockParentGraph, args.childName, args.childVersion);
14
+ const isProjectCopy = projectCopyMatcher(args.packages, args.workspaceMemberNames);
15
+ const blockers = new Map();
16
+ for (const holder of holders) {
17
+ if (holder.name === args.upgradedParent || !holder.range || !isValidRange(holder.range))
18
+ continue;
19
+ if (!isProjectCopy(holder.name, holder.version))
20
+ continue;
21
+ if (satisfiesRange(args.targetChildVersion, holder.range))
22
+ continue;
23
+ blockers.set(`${holder.name}@${holder.version}`, { package: holder.name, version: holder.version, range: holder.range });
24
+ }
25
+ return [...blockers.values()].sort((a, b) => a.package.localeCompare(b.package));
26
+ }
27
+ function npmHolders(graph, childName, childVersion) {
28
+ if (!graph.parentsFor)
29
+ return [];
30
+ const holders = [];
31
+ for (const childNodeId of graph.nodeIdsFor(childName, childVersion)) {
32
+ for (const parentNodeId of graph.parentsFor(childNodeId)) {
33
+ const parent = graph.getNode(parentNodeId);
34
+ if (parent?.version)
35
+ holders.push({ name: parent.name, version: parent.version, range: graph.rangeFor(parentNodeId, childName) });
36
+ }
37
+ }
38
+ return holders;
39
+ }
40
+ // A copy is the project's own when a recorded path reaches it straight from the
41
+ // project, or from a workspace member one step below it.
42
+ function projectCopyMatcher(packages, workspaceMemberNames) {
43
+ const projectCopies = new Set();
44
+ for (const pkg of packages) {
45
+ const direct = (pkg.paths ?? []).some(p => p[p.length - 1] === pkg.name &&
46
+ (p.length === 2 || (p.length === 3 && workspaceMemberNames.has(p[1]))));
47
+ if (direct)
48
+ projectCopies.add(`${pkg.name}@${pkg.version}`);
49
+ }
50
+ return (name, version) => projectCopies.has(`${name}@${version}`);
51
+ }
@@ -1,4 +1,4 @@
1
- import { compareVersions, isPreReleaseVersion, looksLikeVersion } from "../utils/version.js";
1
+ import { compareVersions, isPreReleaseVersion, looksLikeVersion, satisfiesRange } from "../utils/version.js";
2
2
  import { fetchPackument } from "./npm-registry.js";
3
3
  import { findPackageAlongPath } from "./package-path-lookup.js";
4
4
  import { resolveDirectParentContext } from "./parent-candidate-resolver.js";
@@ -72,7 +72,7 @@ export async function resolveHighestSatisfying(name, range) {
72
72
  const versions = Object.keys(packument?.versions ?? {})
73
73
  .filter(looksLikeVersion)
74
74
  .filter(v => !isPreReleaseVersion(v))
75
- .filter(version => versionSatisfiesRange(version, range))
75
+ .filter(version => satisfiesRange(version, range))
76
76
  .sort(compareVersions);
77
77
  return versions.at(-1) ?? null;
78
78
  }
@@ -118,9 +118,9 @@ async function findUpgradeForExactDirectChild(args) {
118
118
  manifest?.optionalDependencies?.[args.vulnerableName];
119
119
  if (!depRange)
120
120
  continue;
121
- const stillAllowsInstalled = versionSatisfiesRange(args.vulnerableInstalledVersion, depRange);
121
+ const stillAllowsInstalled = satisfiesRange(args.vulnerableInstalledVersion, depRange);
122
122
  const allowsFixed = args.vulnerableFixedVersion
123
- ? versionSatisfiesRange(args.vulnerableFixedVersion, depRange)
123
+ ? satisfiesRange(args.vulnerableFixedVersion, depRange)
124
124
  : true;
125
125
  if (!stillAllowsInstalled && allowsFixed) {
126
126
  return {
@@ -198,7 +198,7 @@ async function findUpgradeForImmediateIntermediate(args) {
198
198
  if (!heuristicFallback) {
199
199
  const depRange = manifest.dependencies?.[args.immediateChildName] ??
200
200
  manifest.optionalDependencies?.[args.immediateChildName];
201
- if (depRange && !versionSatisfiesRange(args.immediateChildInstalledVersion, depRange)) {
201
+ if (depRange && !satisfiesRange(args.immediateChildInstalledVersion, depRange)) {
202
202
  heuristicFallback = {
203
203
  package: args.directParentName,
204
204
  currentVersion: args.directParentVersion,
@@ -216,77 +216,3 @@ async function findUpgradeForImmediateIntermediate(args) {
216
216
  }
217
217
  return null;
218
218
  }
219
- function versionSatisfiesRange(version, rawRange) {
220
- const range = rawRange.trim();
221
- if (!range)
222
- return false;
223
- if (range === "*" || range === "latest")
224
- return true;
225
- const orParts = range.split("||").map(part => part.trim()).filter(Boolean);
226
- return orParts.some(part => satisfiesAndRange(version, part));
227
- }
228
- function satisfiesAndRange(version, range) {
229
- const normalized = normalizeRange(range);
230
- if (!normalized)
231
- return false;
232
- const tokens = normalized.split(/\s+/).filter(Boolean);
233
- return tokens.every(token => satisfiesComparator(version, token));
234
- }
235
- function normalizeRange(range) {
236
- const trimmed = range.trim();
237
- if (!trimmed)
238
- return null;
239
- if (looksLikeVersion(trimmed)) {
240
- return `=${trimmed}`;
241
- }
242
- if (trimmed.startsWith("^")) {
243
- const base = trimmed.slice(1);
244
- if (!looksLikeVersion(base))
245
- return null;
246
- const [major, minor, patch] = parseCoreVersion(base);
247
- if (major > 0)
248
- return `>=${base} <${major + 1}.0.0`;
249
- if (minor > 0)
250
- return `>=${base} <0.${minor + 1}.0`;
251
- return `>=${base} <0.0.${patch + 1}`;
252
- }
253
- if (trimmed.startsWith("~")) {
254
- const base = trimmed.slice(1);
255
- if (!looksLikeVersion(base))
256
- return null;
257
- const [major, minor] = parseCoreVersion(base);
258
- return `>=${base} <${major}.${minor + 1}.0`;
259
- }
260
- return trimmed;
261
- }
262
- function satisfiesComparator(version, comparator) {
263
- const token = comparator.trim();
264
- if (!token)
265
- return true;
266
- const match = token.match(/^(<=|>=|<|>|=)?\s*([0-9]+\.[0-9]+\.[0-9]+(?:[-+][^\s]+)?)$/);
267
- if (!match)
268
- return false;
269
- const operator = match[1] ?? "=";
270
- const target = match[2];
271
- const cmp = compareVersions(version, target);
272
- switch (operator) {
273
- case "<":
274
- return cmp < 0;
275
- case "<=":
276
- return cmp <= 0;
277
- case ">":
278
- return cmp > 0;
279
- case ">=":
280
- return cmp >= 0;
281
- case "=":
282
- return cmp === 0;
283
- default:
284
- return false;
285
- }
286
- }
287
- function parseCoreVersion(version) {
288
- const [major, minor, patch] = version
289
- .split(".")
290
- .map(part => Number(part.replace(/[^0-9].*$/, "")));
291
- return [major || 0, minor || 0, patch || 0];
292
- }
@@ -0,0 +1,21 @@
1
+ import { looksLikeVersion } from "../utils/version.js";
2
+ import { fetchPackument } from "./npm-registry.js";
3
+ // Every parent of the installed copy with the range its published manifest declares
4
+ // for the child, or null where the manifest does not say.
5
+ export async function registryParentRanges(graph, childName, childVersion) {
6
+ if (!graph)
7
+ return [];
8
+ const parents = new Map();
9
+ for (const childNodeId of graph.nodeIdsFor(childName, childVersion)) {
10
+ for (const parentNodeId of graph.parentsFor(childNodeId)) {
11
+ const parent = graph.getNode(parentNodeId);
12
+ if (parent && looksLikeVersion(parent.version))
13
+ parents.set(`${parent.name}@${parent.version}`, parent);
14
+ }
15
+ }
16
+ return Promise.all([...parents.values()].map(async (parent) => {
17
+ const manifest = (await fetchPackument(parent.name))?.versions?.[parent.version];
18
+ const range = manifest?.dependencies?.[childName] ?? manifest?.optionalDependencies?.[childName] ?? null;
19
+ return { name: parent.name, version: parent.version, range };
20
+ }));
21
+ }
@@ -1,7 +1,7 @@
1
1
  import { commandPrefix } from "./fix-commands.js";
2
2
  import { fetchPackument } from "./npm-registry.js";
3
- import { compareVersions, looksLikeVersion, isPreReleaseVersion } from "../utils/version.js";
4
- import { versionSatisfiesRange, highestVersionSatisfyingRange } from "./npm-transitive-resolution.js";
3
+ import { compareVersions, looksLikeVersion, isPreReleaseVersion, satisfiesRange } from "../utils/version.js";
4
+ import { highestVersionSatisfyingRange } from "./npm-transitive-resolution.js";
5
5
  export async function resolveChainFix(finding, installedVersions, packageManager, options) {
6
6
  if (options.offline)
7
7
  return null;
@@ -60,7 +60,7 @@ async function traceChain(deps, remainingPath, vulnerableInstalledVersion, fixed
60
60
  if (remainingPath.length === 1) {
61
61
  // Bottom of chain: nextName IS the vulnerable package.
62
62
  // The range from the parent must exclude the vulnerable installed version.
63
- if (versionSatisfiesRange(vulnerableInstalledVersion, range)) {
63
+ if (satisfiesRange(vulnerableInstalledVersion, range)) {
64
64
  // Range still allows the vulnerable version - this candidate does not fix it.
65
65
  return null;
66
66
  }
@@ -6,7 +6,7 @@ export function getCompletenessImpact(completeness) {
6
6
  hasRemediationGap: diagnostics.some(diagnostic => diagnostic.impact === "remediation"),
7
7
  };
8
8
  }
9
- export function formatDiagnosticMessage(code, count, affectedPackageCount) {
9
+ export function formatDiagnosticMessage(code, count, affectedPackageCount, impact) {
10
10
  switch (code) {
11
11
  case "OSV_DETAIL_TRANSIENT_FAILURE":
12
12
  return `${count} advisory detail ${pluralize(count, "lookup")} failed with a transient error: re-run to retry.`;
@@ -23,6 +23,11 @@ export function formatDiagnosticMessage(code, count, affectedPackageCount) {
23
23
  return `${count} transitive remediation ${pluralize(count, "attempt")} failed: some fix recommendations may be missing.`;
24
24
  case "CHAIN_RESOLUTION_FAILURE":
25
25
  return `${count} chain resolution ${pluralize(count, "attempt")} failed: some validated upgrade chains may be missing.`;
26
+ case "UNREADABLE_PYPI_BOUNDARY":
27
+ if (impact === "remediation") {
28
+ return `${count} ${pluralize(count, "package")} ${pluralize(count, "has", "have")} an unreadable PyPI advisory boundary, so the fix is inconclusive.`;
29
+ }
30
+ return `${count} ${pluralize(count, "package")} ${pluralize(count, "has", "have")} an unreadable PyPI version or advisory boundary, so vulnerability status could not be determined.`;
26
31
  default:
27
32
  return `${count} unknown diagnostic occurred.`;
28
33
  }
@@ -31,17 +36,18 @@ export function aggregateMultiFolderCompleteness(results) {
31
36
  const deduped = new Map();
32
37
  for (const result of results) {
33
38
  for (const diagnostic of result.completeness.diagnostics) {
34
- const existing = deduped.get(diagnostic.code);
39
+ const key = `${diagnostic.code}:${diagnostic.impact}`;
40
+ const existing = deduped.get(key);
35
41
  if (existing) {
36
42
  existing.count += diagnostic.count;
37
43
  if (diagnostic.affectedPackageCount !== undefined) {
38
44
  existing.affectedPackageCount =
39
45
  (existing.affectedPackageCount ?? 0) + diagnostic.affectedPackageCount;
40
46
  }
41
- existing.message = formatDiagnosticMessage(diagnostic.code, existing.count, existing.affectedPackageCount);
47
+ existing.message = formatDiagnosticMessage(diagnostic.code, existing.count, existing.affectedPackageCount, existing.impact);
42
48
  }
43
49
  else {
44
- deduped.set(diagnostic.code, { ...diagnostic });
50
+ deduped.set(key, { ...diagnostic });
45
51
  }
46
52
  }
47
53
  }