Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
#2689 Handle 'Packages' attribute in Trivy parser
Add 'Packages' to the expected attributes. However, this attribute will not be parsed due to its irrelevance for vulnerability findings.

Signed-off-by: Boris Shek <boris.shek@iteratec.com>
  • Loading branch information
BorisShek committed Nov 8, 2024
commit 55f08dca6ccc04c8c9b5a14f3c996056f481ee6f
5 changes: 3 additions & 2 deletions scanners/trivy/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ function parseK8sScanResultResource(clusterName, resourceItem, reject) {
for (const aResult of results) {
const {Target: target, Class: clazz, Type: type} = aResult;

var keys = Object.keys(aResult);
const expectedAttributes = ["Target", "Class", "Type", "Misconfigurations", "Vulnerabilities", "MisconfSummary"];
const keys = Object.keys(aResult);
const expectedAttributes = ["Target", "Class", "Type", "Misconfigurations", "Vulnerabilities", "MisconfSummary", "Packages"];
// The "Packages" attribute is now included in the scan report by default starting with Trivy 0.56.0 (https://github.com/aquasecurity/trivy/pull/6765)
const found = keys.find(key => !expectedAttributes.includes(key));
if (found !== undefined) {
reject(new Error("Unexpected attribute '" + found + "' on resource-item"));
Expand Down