Skip to content

Commit 7cefa5b

Browse files
committed
Added checkmarx profile and callstack #4014
1 parent 08d8a3c commit 7cefa5b

22 files changed

+926
-730
lines changed

sechub-web-ui/src/components.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ declare module 'vue' {
1111
AsyncButton: typeof import('./components/AsyncButton.vue')['default']
1212
EmailVerificationSuccess: typeof import('./components/EmailVerificationSuccess.vue')['default']
1313
JobReport: typeof import('./components/JobReport.vue')['default']
14+
JobReportCodescanCallsRecursive: typeof import('./components/JobReportCodescanCallsRecursive.vue')['default']
1415
JobReportCodescanDetails: typeof import('./components/JobReportCodescanDetails.vue')['default']
1516
JobReportOverview: typeof import('./components/JobReportOverview.vue')['default']
1617
JobReportStatus: typeof import('./components/JobReportStatus.vue')['default']

sechub-web-ui/src/components/JobReport.vue

+72-66
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
<!-- SPDX-License-Identifier: MIT -->
22
<template>
33

4-
<JobReportToolBar
5-
:scan-type="scantype"
6-
:project-id="projectId"
4+
<JobReportToolBar
75
:job-u-u-i-d="jobUUID"
8-
:traffic-light="report.trafficLight || ''" />
6+
:project-id="projectId"
7+
:scan-type="scantype"
8+
:traffic-light="report.trafficLight || ''"
9+
/>
910

10-
<v-data-table
11-
:group-by=groupBy
11+
<v-data-table
12+
:group-by="groupBy"
1213
:headers="headers"
13-
:items="sortedFindings"
1414
item-key="id"
15+
:items="sortedFindings"
1516
show-expand
1617
>
17-
18-
<template v-slot:group-header="{ item, columns, toggleGroup, isGroupOpen }">
18+
19+
<template #group-header="{ item, columns, toggleGroup, isGroupOpen }">
1920
<tr>
2021
<td :colspan="columns.length">
2122
<div class="d-flex align-center">
2223
<v-btn
23-
:icon="isGroupOpen(item) ? '$expand' : '$next'"
2424
color="medium-emphasis"
2525
density="comfortable"
26+
:icon="isGroupOpen(item) ? '$expand' : '$next'"
2627
size="small"
2728
variant="outlined"
2829
@click="toggleGroup(item)"
29-
></v-btn>
30+
/>
3031

31-
<span class="ms-4">
32+
<span class="ms-4">
3233
<div>
3334
<v-icon
34-
:color="calculateColor(item.value)"
35-
:icon="calculateIcon(item.value)"
36-
left
37-
class="ma-2">
38-
</v-icon>
35+
class="ma-2"
36+
:color="calculateColor(item.value)"
37+
:icon="calculateIcon(item.value)"
38+
left
39+
/>
3940
<span>{{ item.value }}</span>
4041
</div>
4142
</span>
@@ -44,45 +45,47 @@
4445
</tr>
4546
</template>
4647

47-
<template v-slot:item.severity="{ value }">
48-
<div>
49-
<v-icon
50-
:color="calculateColor(value)"
51-
:icon="calculateIcon(value)"
52-
left
53-
class="ma-2">
54-
</v-icon>
55-
<span>{{ value }}</span>
56-
</div>
48+
<template #item.severity="{ value }">
49+
<div>
50+
<v-icon
51+
class="ma-2"
52+
:color="calculateColor(value)"
53+
:icon="calculateIcon(value)"
54+
left
55+
/>
56+
<span>{{ value }}</span>
57+
</div>
5758
</template>
5859

59-
<template v-slot:item.cweId="{ value }">
60-
<div>
61-
<a :href="`https://cwe.mitre.org/data/definitions/${value}.html`">CWE-{{ value }}</a>
62-
</div>
60+
<template #item.cweId="{ value }">
61+
<div>
62+
<a :href="`https://cwe.mitre.org/data/definitions/${value}.html`">CWE-{{ value }}</a>
63+
</div>
6364
</template>
6465

65-
<template v-slot:item.data-table-expand="{ internalItem, isExpanded, toggleExpand }">
66+
<template #item.data-table-expand="{ internalItem, isExpanded, toggleExpand }">
6667
<v-btn
6768
:append-icon="isExpanded(internalItem) ? 'mdi-chevron-up' : 'mdi-chevron-down'"
68-
:text="isExpanded(internalItem) ? $t('REPORT_COLLAPS_FINDING') : $t('REPORT_SHOW_FINDING')"
6969
class="text-none"
7070
color="primary"
71+
:text="isExpanded(internalItem) ? $t('REPORT_COLLAPS_FINDING') : $t('REPORT_SHOW_FINDING')"
7172
variant="text"
7273
@click="toggleExpand(internalItem)"
73-
></v-btn>
74+
/>
7475
</template>
7576

76-
<template v-slot:expanded-row="{ columns, item }">
77+
<template #expanded-row="{ columns, item }">
7778
<tr>
78-
<td :colspan="columns.length" class="py-2">
79-
<v-sheet v-if="item.type !== 'webScan'" rounded="lg" >
80-
<JobReportCodescanDetails
81-
:item="item"/>
79+
<td class="py-2" :colspan="columns.length">
80+
<v-sheet v-if="item.type !== 'webScan'" rounded="lg">
81+
<JobReportCodescanDetails
82+
:item="item"
83+
/>
8284
</v-sheet>
83-
<v-sheet v-else rounded="lg" >
85+
<v-sheet v-else rounded="lg">
8486
<JobReportWebscanDetails
85-
:item="item"/>
87+
:item="item"
88+
/>
8689
</v-sheet>
8790
</td>
8891
</tr>
@@ -92,7 +95,7 @@
9295
<script lang="ts">
9396
import { useRoute, useRouter } from 'vue-router'
9497
import { useI18n } from 'vue-i18n'
95-
import { SecHubReport } from '@/generated-sources/openapi'
98+
import { SecHubFinding, SecHubReport } from '@/generated-sources/openapi'
9699
import { useReportStore } from '@/stores/reportStore'
97100
import '@/styles/sechub.scss'
98101

@@ -123,69 +126,72 @@
123126
projectId.value = route.params.id
124127
}
125128

126-
if ('jobId' in route.params){
129+
if ('jobId' in route.params) {
127130
jobUUID.value = route.params.jobId
128131
}
129132

130133
const query = route.query.scantype as string
131134
const scantype = ref('')
132135
scantype.value = query
133-
136+
134137
const filteredFindings = computed(() => {
135-
if (report.value.result?.findings){
138+
if (report.value.result?.findings) {
136139
return report.value.result?.findings.filter(finding => finding.type?.toLocaleLowerCase() === scantype.value) || []
140+
} else {
141+
return report.value.result?.findings
137142
}
138143
})
139144

140145
const severityOrder = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'INFO']
141-
const sortedFindings = computed(() => {
146+
147+
const sortedFindings = computed<SecHubFinding[]>(() => {
142148
if (!filteredFindings.value) {
143149
return []
144150
}
145-
return filteredFindings.value.sort((a, b) => {
146-
return severityOrder.indexOf(a.severity || '') - severityOrder.indexOf(b.severity || '')
151+
return [...filteredFindings.value].sort((a, b) => {
152+
return severityOrder.indexOf(a.severity || 'INFO') - severityOrder.indexOf(b.severity || 'INFO')
147153
})
148154
})
149155

150156
onMounted(async () => {
151157
const reportFromStore = store.getReportByUUID(jobUUID.value)
152158
if (!reportFromStore) {
153-
router.push({
154-
path: '/projects',
155-
})
156-
} else {
157-
report.value = reportFromStore
158-
}
159-
})
160-
161-
function calculateIcon(severity :string){
159+
router.push({
160+
path: '/projects',
161+
})
162+
} else {
163+
report.value = reportFromStore
164+
}
165+
})
166+
167+
function calculateIcon (severity :string) {
162168
switch (severity) {
163169
case 'CRITICAL':
164170
case 'HIGH':
165-
return 'mdi-alert-circle-outline';
171+
return 'mdi-alert-circle-outline'
166172
case 'MEDIUM':
167-
return 'mdi-alert-circle-outline';
173+
return 'mdi-alert-circle-outline'
168174
case 'LOW':
169175
case 'INFO':
170-
return 'mdi-information-outline';
176+
return 'mdi-information-outline'
171177
default:
172-
return 'mdi-help-circle';
178+
return 'mdi-help-circle'
173179
}
174180
}
175181

176-
function calculateColor(severity: string){
182+
function calculateColor (severity: string) {
177183
switch (severity) {
178184
case 'CRITICAL':
179185
case 'HIGH':
180-
return 'error';
186+
return 'error'
181187
case 'MEDIUM':
182-
return 'warning';
188+
return 'warning'
183189
case 'LOW':
184190
return 'success'
185191
case 'INFO':
186-
return 'primary';
192+
return 'primary'
187193
default:
188-
return 'layer_01';
194+
return 'layer_01'
189195
}
190196
}
191197

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<template v-if="call.calls">
3+
<tr>
4+
<td>{{ call.location }}</td>
5+
<td>{{ call.line }}</td>
6+
<td>{{ call.column }}</td>
7+
<td>{{ call.relevantPart }}</td>
8+
<td>{{ call.source }}</td>
9+
</tr>
10+
<JobReportCodescanCallsRecursive :call="call.calls" />
11+
</template>
12+
<template v-else>
13+
<tr>
14+
<td>{{ call.location }}</td>
15+
<td>{{ call.line }}</td>
16+
<td>{{ call.column }}</td>
17+
<td>{{ call.relevantPart }}</td>
18+
<td>{{ call.source }}</td>
19+
</tr>
20+
</template>
21+
</template>
22+
<script lang="ts">
23+
import { defineComponent } from 'vue'
24+
25+
export default defineComponent({
26+
name: 'JobReportCodescanCallsRecursive',
27+
props: {
28+
call: {
29+
type: Object,
30+
required: true,
31+
},
32+
},
33+
})
34+
</script>

0 commit comments

Comments
 (0)