Skip to content

Commit c812db5

Browse files
xingzhang-suserushk014
authored andcommitted
#174: Confirmation: Some pending topic on Image overview page regarding reports and global filters and more bug fixes
1 parent f82275e commit c812db5

File tree

11 files changed

+108
-575
lines changed

11 files changed

+108
-575
lines changed

pkg/sbombastic-image-vulnerability-scanner/components/ImageDetails.vue

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
</div>
9999
<div class="info-item">
100100
<span class="label">{{ t('imageScanner.imageDetails.imageId') }}:</span>
101-
<span class="value">{{ imageDetails.imageId || 'sha256:abc123...' }}</span>
101+
<span class="value">{{ imageDetails.imageId?.split(':')[1] || 'Unknown' }}</span>
102102
</div>
103103
<div class="info-item">
104104
<span class="label">{{ t('imageScanner.imageDetails.layers') }}:</span>
@@ -541,21 +541,22 @@ export default {
541541
542542
// Transform the vulnerability data to match the expected format
543543
return vulnerabilities.map((vuln, index) => ({
544-
id: `${ vuln.cve }-${ vuln.packageName }-${ index }`, // Create unique ID
545-
cveId: vuln.cve,
546-
score: vuln.cvss?.nvd?.v3score ? `${ vuln.cvss.nvd.v3score } (CVSS v3)` : vuln.cvss?.redhat?.v3score ? `${ vuln.cvss.redhat.v3score } (CVSS v3)` : vuln.cvss?.ghsa?.v3score ? `${ vuln.cvss.ghsa.v3score } (CVSS v3)` : '',
547-
package: vuln.packageName,
548-
packageVersion: vuln.installedVersion,
549-
packagePath: vuln.purl || vuln.diffID, // Use purl if available, fallback to diffID
550-
fixAvailable: vuln.fixedVersions && vuln.fixedVersions.length > 0,
551-
fixVersion: vuln.fixedVersions ? vuln.fixedVersions.join(', ') : '',
552-
severity: vuln.severity?.toLowerCase() || this.t('imageScanner.general.unknown'),
553-
exploitability: vuln.suppressed ? 'suppressed' : 'affected',
554-
description: vuln.description,
555-
title: vuln.title,
556-
references: vuln.references || [],
544+
id: `${ vuln.cve }-${ vuln.packageName }-${ index }`, // Create unique ID
545+
cveId: vuln.cve,
546+
score: vuln.cvss?.nvd?.v3score ? `${ vuln.cvss.nvd.v3score } (CVSS v3)` : vuln.cvss?.redhat?.v3score ? `${ vuln.cvss.redhat.v3score } (CVSS v3)` : vuln.cvss?.ghsa?.v3score ? `${ vuln.cvss.ghsa.v3score } (CVSS v3)` : '',
547+
package: vuln.packageName,
548+
packageVersion: vuln.installedVersion,
549+
packagePath: vuln.purl || vuln.diffID, // Use purl if available, fallback to diffID
550+
fixAvailable: vuln.fixedVersions && vuln.fixedVersions.length > 0,
551+
fixVersion: vuln.fixedVersions ? vuln.fixedVersions.join(', ') : '',
552+
severity: vuln.severity?.toLowerCase() || this.t('imageScanner.general.unknown'),
553+
exploitability: vuln.suppressed ? 'Suppressed' : 'Affected',
554+
description: vuln.description,
555+
title: vuln.title,
556+
references: vuln.references || [],
557557
// Add diffID for layer grouping
558-
diffID: vuln.diffID
558+
diffID: vuln.diffID,
559+
installedVersion: vuln.installedVersion
559560
}));
560561
},
561562
@@ -909,7 +910,7 @@ export default {
909910
// Generate CSV from vulnerability report data
910911
const csvData = this.generateCSVFromVulnerabilityReport();
911912
912-
this.downloadCSV(csvData, `${ this.imageName }-image-detail-report.csv`);
913+
this.downloadCSV(csvData, `${ this.imageName }-image-detail-report_${ day(new Date().getTime()).format('MMDDYYYY_HHmmss') }.csv`);
913914
914915
this.$store.dispatch('growl/success', {
915916
title: 'Success',
@@ -1162,7 +1163,7 @@ export default {
11621163
// Generate CSV from vulnerability report data
11631164
const csvData = this.generateCSVFromVulnerabilityReport();
11641165
1165-
this.downloadCSV(csvData, `${ this.imageName }-full-report.csv`);
1166+
this.downloadCSV(csvData, `${ this.imageName }-full-report_${ day(new Date().getTime()).format('MMDDYYYY_HHmmss') }.csv`);
11661167
11671168
this.$store.dispatch('growl/success', {
11681169
title: 'Success',
@@ -1190,7 +1191,7 @@ export default {
11901191
// Generate CSV from filtered vulnerability data
11911192
const csvData = this.generateCSVFromFilteredVulnerabilities();
11921193
1193-
this.downloadCSV(csvData, `${ this.imageName }-custom-report.csv`);
1194+
this.downloadCSV(csvData, `${ this.imageName }-custom-report_${ day(new Date().getTime()).format('MMDDYYYY_HHmmss') }.csv`);
11941195
11951196
this.$store.dispatch('growl/success', {
11961197
title: 'Success',
@@ -1207,15 +1208,15 @@ export default {
12071208
generateCSVFromVulnerabilityReport() {
12081209
const vulnerabilities = this.vulnerabilityDetails;
12091210
const headers = [
1210-
'CVE ID',
1211-
'Score',
1212-
'Package',
1213-
'Package Version',
1214-
'Package Path',
1215-
'Fix Available',
1216-
'Fix Version',
1217-
'Severity',
1218-
'Exploitability'
1211+
'CVE_ID',
1212+
'SCORE',
1213+
'PACKAGE',
1214+
'FIX AVAILABLE',
1215+
'SEVERITY',
1216+
'EXPLOITABILITY',
1217+
'PACKAGE VERSION',
1218+
'PACKAGE PATH',
1219+
'DESCRIPTION',
12191220
];
12201221
12211222
const csvRows = [headers.join(',')];
@@ -1225,12 +1226,12 @@ export default {
12251226
`"${ vuln.cveId || '' }"`,
12261227
`"${ vuln.score || '' }"`,
12271228
`"${ vuln.package || '' }"`,
1228-
`"${ vuln.packageVersion || '' }"`,
1229-
`"${ vuln.packagePath || '' }"`,
1230-
`"${ vuln.fixAvailable ? 'Yes' : 'No' }"`,
1231-
`"${ vuln.fixVersion || '' }"`,
1229+
`"${ vuln.fixVersion }"`,
12321230
`"${ vuln.severity || '' }"`,
1233-
`"${ vuln.exploitability || '' }"`
1231+
`"${ vuln.exploitability || '' }"`,
1232+
`"${ vuln.installedVersion || '' }"`,
1233+
`"${ vuln.packagePath || '' }"`,
1234+
`"${ vuln.description.replace(/[\r\n]+/g, ' ') }"`,
12341235
];
12351236
12361237
csvRows.push(row.join(','));
@@ -1244,15 +1245,15 @@ export default {
12441245
const vulnerabilities = this.selectedVulnerabilities && this.selectedVulnerabilities.length > 0 ? this.selectedVulnerabilities : this.filteredVulnerabilities;
12451246
12461247
const headers = [
1247-
'CVE ID',
1248-
'Score',
1249-
'Package',
1250-
'Package Version',
1251-
'Package Path',
1252-
'Fix Available',
1253-
'Fix Version',
1254-
'Severity',
1255-
'Exploitability'
1248+
'CVE_ID',
1249+
'SCORE',
1250+
'PACKAGE',
1251+
'FIX AVAILABLE',
1252+
'SEVERITY',
1253+
'EXPLOITABILITY',
1254+
'PACKAGE VERSION',
1255+
'PACKAGE PATH',
1256+
'DESCRIPTION',
12561257
];
12571258
12581259
const csvRows = [headers.join(',')];
@@ -1262,12 +1263,12 @@ export default {
12621263
`"${ vuln.cveId || '' }"`,
12631264
`"${ vuln.score || '' }"`,
12641265
`"${ vuln.package || '' }"`,
1265-
`"${ vuln.packageVersion || '' }"`,
1266-
`"${ vuln.packagePath || '' }"`,
1267-
`"${ vuln.fixAvailable ? 'Yes' : 'No' }"`,
1268-
`"${ vuln.fixVersion || '' }"`,
1266+
`"${ vuln.fixVersion }"`,
12691267
`"${ vuln.severity || '' }"`,
1270-
`"${ vuln.exploitability || '' }"`
1268+
`"${ vuln.exploitability || '' }"`,
1269+
`"${ vuln.installedVersion || '' }"`,
1270+
`"${ vuln.packagePath || '' }"`,
1271+
`"${ vuln.description.replace(/[\r\n]+/g, ' ') }"`,
12711272
];
12721273
12731274
csvRows.push(row.join(','));

pkg/sbombastic-image-vulnerability-scanner/config/table-headers.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ export const IMAGE_LIST_TABLE = [
152152
{
153153
name: "name",
154154
labelKey: "imageScanner.images.listTable.headers.imageName",
155+
value: "imageReference",
155156
formatter: "ImageNameCell",
156-
sort: "name",
157+
sort: "imageReference",
157158
},
158159
{
159160
name: "cves",
@@ -181,7 +182,12 @@ export const IMAGE_LIST_TABLE = [
181182
labelKey: "imageScanner.images.listTable.headers.registry",
182183
value: "imageMetadata.registry",
183184
formatter: "RegistryCellLink",
184-
sort: "imageMetadata.registry",
185+
sort: ['metadata.namespace','imageMetadata.registry'],
186+
},{
187+
name: "repository",
188+
labelKey: "imageScanner.images.listTable.headers.repository",
189+
value: "imageMetadata.repository",
190+
sort: 'imageMetadata.repository',
185191
},
186192
{
187193
name: "platform",

0 commit comments

Comments
 (0)