fix: dedupe sentinel artifact findings by id
This commit is contained in:
@@ -333,7 +333,7 @@ function mergeSentinelReportFindings(primary: readonly Record<string, unknown>[]
|
|||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
for (const item of [...primary, ...artifact]) {
|
for (const item of [...primary, ...artifact]) {
|
||||||
const id = sentinelReportFindingIdentity(item);
|
const id = sentinelReportFindingIdentity(item);
|
||||||
const key = `${id ?? JSON.stringify(item).slice(0, 160)}:${stringAtNullable(item, "severity") ?? stringAtNullable(item, "level") ?? ""}`;
|
const key = id ?? `${JSON.stringify(item).slice(0, 160)}:${stringAtNullable(item, "severity") ?? stringAtNullable(item, "level") ?? ""}`;
|
||||||
if (seen.has(key)) continue;
|
if (seen.has(key)) continue;
|
||||||
seen.add(key);
|
seen.add(key);
|
||||||
merged.push(item);
|
merged.push(item);
|
||||||
|
|||||||
@@ -1536,7 +1536,8 @@ function mergeVisibleFindings(primary: readonly Record<string, unknown>[], artif
|
|||||||
const merged: Record<string, unknown>[] = [];
|
const merged: Record<string, unknown>[] = [];
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
for (const item of [...primary, ...artifact]) {
|
for (const item of [...primary, ...artifact]) {
|
||||||
const key = `${findingIdentity(item) ?? JSON.stringify(item).slice(0, 160)}:${stringOrNull(item.severity) ?? stringOrNull(item.level) ?? ""}`;
|
const id = findingIdentity(item);
|
||||||
|
const key = id ?? `${JSON.stringify(item).slice(0, 160)}:${stringOrNull(item.severity) ?? stringOrNull(item.level) ?? ""}`;
|
||||||
if (seen.has(key)) continue;
|
if (seen.has(key)) continue;
|
||||||
seen.add(key);
|
seen.add(key);
|
||||||
merged.push(item);
|
merged.push(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user