Skip to content

Commit a9eea68

Browse files
Added installation page, Crrected image assessment chart and added the severity filter
1 parent 640184a commit a9eea68

21 files changed

+745
-347
lines changed

pkg/sbombastic-image-vulnerability-scanner/assets/img/neuvector-logo.svg

Lines changed: 1 addition & 0 deletions
Loading

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@
241241
import SortableTable from "@shell/components/SortableTable";
242242
import { BadgeState } from '@components/BadgeState';
243243
import Checkbox from '@components/Form/Checkbox';
244-
import ScoreBadge from '@sbombastic-image-vulnerability-scanner/components/common/ScoreBadge';
245-
import BarChart from '@sbombastic-image-vulnerability-scanner/components/common/BarChart';
246-
import { VULNERABILITY_DETAILS_TABLE } from "@sbombastic-image-vulnerability-scanner/config/table-headers";
247-
import { images } from "@sbombastic-image-vulnerability-scanner/data/sbombastic.rancher.io.image";
244+
import ScoreBadge from '@pkg/components/common/ScoreBadge';
245+
import BarChart from '@pkg/components/common/BarChart';
246+
import { VULNERABILITY_DETAILS_TABLE } from "@pkg/config/table-headers";
247+
import { images } from "@pkg/data/sbombastic.rancher.io.image";
248248
249249
export default {
250250
name: 'ImageDetails',

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{ t('imageScanner.images.imageRiskAssessment.title') }}
55
</div>
66
<div class="severity-bar-chart">
7-
<BarChart :chartData="chartData" colorPrefix="cve" :description="t('imageScanner.images.imageRiskAssessment.subTitle')" />
7+
<BarChart :chartData="chartData" colorPrefix="cve" :filterFn="filterFn" :description="t('imageScanner.images.imageRiskAssessment.subTitle')" />
88
</div>
99
</div>
1010
</template>
@@ -21,7 +21,11 @@
2121
chartData: {
2222
type: Object,
2323
required: true
24-
}
24+
},
25+
filterFn: {
26+
type: Function,
27+
required: false
28+
},
2529
},
2630
data() {}
2731
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{ t('imageScanner.registries.StatusDistribution.title') }}
55
</div>
66
<div class="severity-bar-chart">
7-
<BarChart :chartData="chartData" colorPrefix="status" :description="t('imageScanner.registries.StatusDistribution.subTitle')" />
7+
<BarChart :filterFn="filterFn" :chartData="chartData" colorPrefix="status" :description="t('imageScanner.registries.StatusDistribution.subTitle')" />
88
</div>
99
</div>
1010
</template>
@@ -21,7 +21,11 @@
2121
chartData: {
2222
type: Object,
2323
required: true
24-
}
24+
},
25+
filterFn: {
26+
type: Function,
27+
required: false
28+
},
2529
},
2630
data() {}
2731
}

pkg/sbombastic-image-vulnerability-scanner/components/common/BarChart.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</div>
77
<div class="severity-chart">
88
<div v-for="(value, key) in chartData" :key="key" class="severity-item">
9-
<div class="severity-item-name">{{ t(`imageScanner.enum.${ colorPrefix }.${ key.toLowerCase() }`) }}</div>
9+
<div class="severity-item-name" @click="filterByCategory(key)">{{ t(`imageScanner.enum.${ colorPrefix }.${ key.toLowerCase() }`) }}</div>
1010
<PercentageBar class="severity-item-bar" :colorStops="{0: `--${ colorPrefix }-${ key.toLowerCase() }`}" :value="percentage(value)" :height="7"/>
1111
<div class="severity-item-value"> {{ value }}</div>
1212
</div>
@@ -34,11 +34,18 @@ export default {
3434
colorPrefix: {
3535
type: String,
3636
required: true
37-
}
37+
},
38+
filterFn: {
39+
type: Function,
40+
required: false
41+
},
3842
},
3943
methods: {
4044
percentage(value) {
4145
return this.total > 0 ? (value / this.total) * 100 : 0;
46+
},
47+
filterByCategory(category) {
48+
this.filterFn && this.filterFn(category);
4249
}
4350
},
4451
computed: {
@@ -102,6 +109,8 @@ export default {
102109
width: 80px;
103110
align-items: right;
104111
gap: 12px;
112+
text-decoration: underline;
113+
cursor: pointer;
105114
}
106115
107116
.severity-item-bar {

pkg/sbombastic-image-vulnerability-scanner/components/common/SevereVulnerabilitiesItem.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<BlockPercentageBar
1111
class="percentage-bar"
1212
:percentage="(vulnerability.spec.impactedImages / vulnerability.spec.totalImages) * 100"
13-
:eventHandler="eventHandler"
13+
:eventHandler="resize"
1414
/>
1515
</div>
1616
</div>
@@ -32,15 +32,14 @@
3232
type: Object,
3333
required: true
3434
},
35-
eventHandler: {
36-
type: Function,
37-
default: null
38-
}
3935
},
4036
data() {
4137
return { };
4238
},
4339
methods: {
40+
resize(fn) {
41+
window.addEventListener('resize', this.debounce(fn), 500);
42+
},
4443
}
4544
}
4645
</script>

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

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,29 @@ import {
55
RESOURCE
66
} from "@pkg/types";
77

8-
export function init($plugin: IPlugin, store: any) {
9-
const { product, virtualType, basicType } = $plugin.DSL(store, PRODUCT_NAME);
8+
export function init($plugin: any, store: any) {
9+
const { product, virtualType, basicType, weightType } = $plugin.DSL(store, PRODUCT_NAME);
1010

1111
product({
12-
icon: "pod_security",
13-
inStore: "cluster",
12+
icon: "pod_security",
13+
inStore: "cluster",
14+
inExplorer: true,
15+
removeable: false,
16+
showNamespaceFilter: true
17+
});
18+
19+
virtualType({
20+
labelKey: 'imageScanner.dashboard.title',
21+
name: PAGE.DASHBOARD,
22+
namespaced: false,
23+
route: {
24+
name: `c-cluster-${PRODUCT_NAME}-${PAGE.DASHBOARD}`,
25+
params: {
26+
product: PRODUCT_NAME
27+
},
28+
meta: { pkg: PRODUCT_NAME, product: PRODUCT_NAME }
29+
},
30+
overview: true
1431
});
1532

1633
virtualType({
@@ -91,11 +108,14 @@ export function init($plugin: IPlugin, store: any) {
91108
},
92109
});
93110

111+
weightType(PAGE.DASHBOARD, 98, true);
112+
weightType(PAGE.IMAGE_OVERVIEW, 97, true);
113+
weightType(PAGE.VULNERABILITY_OVERVIEW, 96, true);
114+
94115
basicType([
95116
PAGE.DASHBOARD,
96-
PAGE.IMAGE_OVERVIEW,
97-
PAGE.VULNERABILITY_OVERVIEW,
98-
//"demo"
117+
PAGE.IMAGE_OVERVIEW,
118+
PAGE.VULNERABILITY_OVERVIEW,
99119
]);
100120
// Prepend spaces on group name, as Rancher 2.12 render group name algin with sidemenu
101121
basicType([PAGE.REGISTRIES, PAGE.VEX_MANAGEMENT, RESOURCE.VEX_HUB], '&nbsp;&nbsp;&nbsp;&nbsp;Advanced');

pkg/sbombastic-image-vulnerability-scanner/data/sbombastic.rancher.io.image.js

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const images = [
55
name: "struts-attacher:1.0",
66
},
77
spec: {
8+
isBaseImage: true,
9+
hasAffectedPackages: true,
810
repository: "coredns",
911
registry: "Docker Hub",
1012
scanResult: {
@@ -22,10 +24,12 @@ export const images = [
2224
name: "imagemagick4.8.5613",
2325
},
2426
spec: {
27+
isBaseImage: false,
28+
hasAffectedPackages: true,
2529
repository: "demo-cody-protected",
2630
registry: "demo.suse-security-ivs.io",
2731
scanResult: {
28-
critical: 7,
32+
critical: 0,
2933
high: 0,
3034
medium: 1028,
3135
low: 24,
@@ -39,6 +43,8 @@ export const images = [
3943
name: "centos7.7.1908",
4044
},
4145
spec: {
46+
isBaseImage: true,
47+
hasAffectedPackages: false,
4248
repository: "kube-controller-manager",
4349
registry: "ecr.ap-southeast-emea.2",
4450
scanResult: {
@@ -56,10 +62,12 @@ export const images = [
5662
name: "nginx1.19.10",
5763
},
5864
spec: {
65+
isBaseImage: false,
66+
hasAffectedPackages: true,
5967
repository: "kube-apiserver",
6068
registry: "Docker Hub",
6169
scanResult: {
62-
critical: 150,
70+
critical: 0,
6371
high: 5,
6472
medium: 850,
6573
low: 600,
@@ -73,6 +81,8 @@ export const images = [
7381
name: "docker-compose:1.29.2",
7482
},
7583
spec: {
84+
isBaseImage: true,
85+
hasAffectedPackages: false,
7686
repository: "coredns",
7787
registry: "Docker Hub",
7888
scanResult: {
@@ -90,12 +100,14 @@ export const images = [
90100
name: "python3.9.7",
91101
},
92102
spec: {
103+
isBaseImage: false,
104+
hasAffectedPackages: true,
93105
repository: "flask-app",
94106
registry: "pypi.org",
95107
scanResult: {
96-
critical: 80,
97-
high: 3,
98-
medium: 1100,
108+
critical: 0,
109+
high: 0,
110+
medium: 0,
99111
low: 50,
100112
none: 0
101113
}
@@ -107,6 +119,8 @@ export const images = [
107119
name: "nodejs14.17.3",
108120
},
109121
spec: {
122+
isBaseImage: true,
123+
hasAffectedPackages: true,
110124
repository: "web-server",
111125
registry: "npmjs.com",
112126
scanResult: {
@@ -124,10 +138,12 @@ export const images = [
124138
name: "redis5.0.7",
125139
},
126140
spec: {
141+
isBaseImage: false,
142+
hasAffectedPackages: false,
127143
repository: "cache-service",
128144
registry: "Docker Hub",
129145
scanResult: {
130-
critical: 58,
146+
critical: 0,
131147
high: 0,
132148
medium: 700,
133149
low: 0,
@@ -141,6 +157,8 @@ export const images = [
141157
name: "mongodb4.4.1",
142158
},
143159
spec: {
160+
isBaseImage: true,
161+
hasAffectedPackages: true,
144162
repository: "data-store",
145163
registry: "mongodb.com",
146164
scanResult: {
@@ -158,13 +176,15 @@ export const images = [
158176
name: "golang1.16.5",
159177
},
160178
spec: {
179+
isBaseImage: false,
180+
hasAffectedPackages: false,
161181
repository: "api-gateway",
162182
registry: "demo.suse-security-ivs.io",
163183
scanResult: {
164-
critical: 75,
165-
high: 1,
166-
medium: 1200,
167-
low: 10,
184+
critical: 0,
185+
high: 0,
186+
medium: 0,
187+
low: 0,
168188
none: 18
169189
}
170190
},
@@ -175,10 +195,12 @@ export const images = [
175195
name: "ruby2.7.3",
176196
},
177197
spec: {
198+
isBaseImage: true,
199+
hasAffectedPackages: false,
178200
repository: "web-application",
179201
registry: "rubygems.org",
180202
scanResult: {
181-
critical: 60,
203+
critical: 0,
182204
high: 1,
183205
medium: 500,
184206
low: 80,
@@ -192,6 +214,8 @@ export const images = [
192214
name: "elasticsearch7.10.0",
193215
},
194216
spec: {
217+
isBaseImage: false,
218+
hasAffectedPackages: true,
195219
repository: "search-service",
196220
registry: "docker.elastic.co",
197221
scanResult: {
@@ -209,10 +233,12 @@ export const images = [
209233
name: "mysql8.0.25",
210234
},
211235
spec: {
236+
isBaseImage: true,
237+
hasAffectedPackages: false,
212238
repository: "database-service",
213239
registry: "mysql.com",
214240
scanResult: {
215-
critical: 70,
241+
critical: 0,
216242
high: 0,
217243
medium: 850,
218244
low: 0,
@@ -226,10 +252,12 @@ export const images = [
226252
name: "php8.0.9",
227253
},
228254
spec: {
255+
isBaseImage: false,
256+
hasAffectedPackages: true,
229257
repository: "web-backend",
230258
registry: "php.net",
231259
scanResult: {
232-
critical: 55,
260+
critical: 0,
233261
high: 0,
234262
medium: 400,
235263
low: 60,
@@ -243,6 +271,8 @@ export const images = [
243271
name: "postgresql13.3",
244272
},
245273
spec: {
274+
isBaseImage: true,
275+
hasAffectedPackages: true,
246276
repository: "data-service",
247277
registry: "docker.io",
248278
scanResult: {
@@ -260,6 +290,8 @@ export const images = [
260290
name: "terraform1.0.0",
261291
},
262292
spec: {
293+
isBaseImage: false,
294+
hasAffectedPackages: false,
263295
repository: "infrastructure-as-code",
264296
registry: "demo.suse-security-ivs.io",
265297
scanResult: {
@@ -277,6 +309,8 @@ export const images = [
277309
name: "ansible2.10.5",
278310
},
279311
spec: {
312+
isBaseImage: true,
313+
hasAffectedPackages: false,
280314
repository: "automation-service",
281315
registry: "galaxy.ansible.com",
282316
scanResult: {
@@ -294,6 +328,8 @@ export const images = [
294328
name: "kafka2.8.0",
295329
},
296330
spec: {
331+
isBaseImage: false,
332+
hasAffectedPackages: true,
297333
repository: "streaming-service",
298334
registry: "confluent.io",
299335
scanResult: {

0 commit comments

Comments
 (0)