thrownewError("Validation of findings failed for unknown reasons.");
}
}
exportfunctionaddScanMetadata(
findings: FindingWithIdsAndDates[],
scan: Scan,
): Finding[]{
constscanMetadata={
created_at: scan.metadata.creationTimestamp,
name: scan.metadata.name,
namespace: scan.metadata.namespace,
scan_type: scan.spec.scanType,
};
returnfindings.map((finding)=>({
...finding,
scan: scanMetadata,
}));
}
exportfunctionaddIdsAndDates(
findings: FindingFromParser[],
): FindingWithIdsAndDates[]{
returnfindings.map((finding)=>{
return{
...finding,
id: randomUUID(),
parsed_at: newDate().toISOString(),
};
});
}
// used for tests to validate if the parser sets all required fields correctly. Adds sample IDs and Dates to the findings which would normally be set by the parser-sdk.