Skip to content

Commit 08d8a3c

Browse files
committed
Adjusted openapi.yaml #4037
1 parent 2a46819 commit 08d8a3c

File tree

11 files changed

+269
-25
lines changed

11 files changed

+269
-25
lines changed

sechub-openapi-java/src/main/resources/openapi.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,11 @@ components:
985985
type: string
986986
version:
987987
type: string
988+
headers:
989+
type: object
990+
additionalProperties: true
991+
body:
992+
$ref: '#/components/schemas/SecHubReportWebBody'
988993

989994
SecHubReportWebBodyLocation:
990995
title: SecHubReportWebBodyLocation

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

+23-9
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
<v-data-table
1111
:group-by=groupBy
1212
:headers="headers"
13-
:items="report.result?.findings"
13+
:items="sortedFindings"
1414
item-key="id"
15-
:sort-by=sortById
1615
show-expand
1716
>
1817

@@ -115,11 +114,10 @@
115114
{ title: 'ID', key: 'id', sortable: true },
116115
{ title: t('REPORT_DESCRIPTION_SEVERITY'), key: 'severity' },
117116
{ title: 'CWE', key: 'cweId' },
118-
{ title: t('REPORT_DESCRIPTION_TYPE'), key: 'type' },
119-
{ title: t('REPORT_DESCRIPTION_DESCRIPTION'), key: 'description', sortable: false },
120-
]
121-
const sortById = ref([{ key: 'id', order: true }])
122-
const groupBy = ref([{ key: 'severity', order: false }])
117+
{ title: t('REPORT_DESCRIPTION_NAME'), key: 'name' },
118+
]
119+
120+
const groupBy = ref([{ key: 'severity', order: false }])
123121

124122
if ('id' in route.params) {
125123
projectId.value = route.params.id
@@ -132,6 +130,22 @@
132130
const query = route.query.scantype as string
133131
const scantype = ref('')
134132
scantype.value = query
133+
134+
const filteredFindings = computed(() => {
135+
if (report.value.result?.findings){
136+
return report.value.result?.findings.filter(finding => finding.type?.toLocaleLowerCase() === scantype.value) || []
137+
}
138+
})
139+
140+
const severityOrder = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'INFO']
141+
const sortedFindings = computed(() => {
142+
if (!filteredFindings.value) {
143+
return []
144+
}
145+
return filteredFindings.value.sort((a, b) => {
146+
return severityOrder.indexOf(a.severity || '') - severityOrder.indexOf(b.severity || '')
147+
})
148+
})
135149

136150
onMounted(async () => {
137151
const reportFromStore = store.getReportByUUID(jobUUID.value)
@@ -181,10 +195,10 @@
181195
report,
182196
scantype,
183197
headers,
184-
sortById,
185198
groupBy,
186199
calculateColor,
187-
calculateIcon
200+
calculateIcon,
201+
sortedFindings,
188202
}
189203
},
190204
}

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

+85-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
<tbody>
1919
<tr>
20-
<td>{{ item.code?.calls }}</td>
20+
<td v-if="item.code?.calls">{{ item.code?.calls }}</td>
21+
<td v-else>1</td>
2122
<td>{{ item.code?.location }}</td>
2223
<td>{{ item.code?.line}}</td>
2324
<td>{{ item.code?.column}}</td>
@@ -27,16 +28,76 @@
2728
</tbody>
2829
</v-table>
2930

30-
<v-table
31-
class="background-color"
31+
<!-- Revision Table -->
32+
<div>
33+
<v-table v-if="item.revision?.id"
34+
class="background-color sechub-report-expandable-element"
35+
fixed-header>
36+
<tbody class="sechub-primary-color">
37+
<tr>
38+
<v-btn
39+
:append-icon="isExpanded.revision ? 'mdi-chevron-up' : 'mdi-chevron-down'"
40+
:text="isExpanded.revision ? $t('REPORT_REVISION_HIDE') : $t('REPORT_REVISION_SHOW')"
41+
class="text-none background-color ma-2"
42+
color="primary"
43+
variant="text"
44+
@click="toggleExpand('revision')">
45+
</v-btn>
46+
</tr>
47+
</tbody>
48+
<tbody v-if="isExpanded.revision">
49+
<tr>
50+
<td> {{ item.revision?.id }} </td>
51+
</tr>
52+
</tbody>
53+
</v-table>
54+
</div>
55+
56+
<!-- Description Table -->
57+
<div>
58+
<v-table
59+
class="background-color sechub-report-expandable-element"
60+
fixed-header
61+
>
62+
<tbody class="sechub-primary-color">
63+
<tr>
64+
<v-btn
65+
:append-icon="isExpanded.description ? 'mdi-chevron-up' : 'mdi-chevron-down'"
66+
:text="isExpanded.description ? $t('REPORT_DESCRIPTION_HIDE') : $t('REPORT_DESCRIPTION_SHOW')"
67+
class="text-none background-color ma-2"
68+
color="primary"
69+
variant="text"
70+
@click="toggleExpand('description')">
71+
</v-btn>
72+
</tr>
73+
</tbody>
74+
<tbody v-if="isExpanded.description">
75+
<tr>
76+
<td> {{ item.description }} </td>
77+
</tr>
78+
</tbody>
79+
</v-table>
80+
</div>
81+
82+
<!-- Solution Table -->
83+
<div>
84+
<v-table
85+
class="background-color sechub-report-expandable-element"
3286
fixed-header
3387
>
3488
<tbody class="sechub-primary-color">
3589
<tr>
36-
<th>{{ $t('REPORT_DESCRIPTION_SOLUTION')}}</th>
90+
<v-btn
91+
:append-icon="isExpanded.solution ? 'mdi-chevron-up' : 'mdi-chevron-down'"
92+
:text="isExpanded.solution ? $t('REPORT_SOLUTION_HIDE') : $t('REPORT_SOLUTION_SHOW')"
93+
class="text-none background-color ma-2"
94+
color="primary"
95+
variant="text"
96+
@click="toggleExpand('solution')">
97+
</v-btn>
3798
</tr>
3899
</tbody>
39-
<tbody>
100+
<tbody v-if="isExpanded.solution">
40101
<tr>
41102
<td v-if="item.solution"> {{ item.solution }} </td>
42103
<td v-else>{{ $t('REPORT_DESCRIPTION_SOLUTION_EMPTY')}}
@@ -45,6 +106,7 @@
45106
</tr>
46107
</tbody>
47108
</v-table>
109+
</div>
48110
</template>
49111
<script lang="ts">
50112
import { defineComponent, toRefs } from 'vue'
@@ -56,6 +118,12 @@ interface Props {
56118
item: SecHubFinding
57119
}
58120

121+
interface ExpandedState {
122+
revision: boolean;
123+
solution: boolean;
124+
description: boolean;
125+
}
126+
59127
export default defineComponent({
60128
props: {
61129
item: {
@@ -67,8 +135,20 @@ export default defineComponent({
67135
setup (props: Props, {}) {
68136
const { item } = toRefs(props)
69137

138+
const isExpanded = ref<ExpandedState>({
139+
revision: false,
140+
solution: false,
141+
description: false,
142+
})
143+
144+
const toggleExpand = (table: keyof ExpandedState) => {
145+
isExpanded.value[table] = !isExpanded.value[table]
146+
}
147+
70148
return {
71149
getTrafficLightClass,
150+
toggleExpand,
151+
isExpanded,
72152
item,
73153
}
74154
},

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

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<th class="background-color">{{ $t('REPORT_TOTAL_FINDINGS') }}</th>
4646
<th class="background-color">{{ $t('REPORT_CRITICAL_FINDINGS') }}</th>
4747
<th class="background-color">{{ $t('REPORT_HIGH_FINDINGS') }}</th>
48+
<th class="background-color">{{ $t('REPORT_MEDIUM_FINDINGS') }}</th>
4849
<th class="background-color">{{ $t('REPORT_LOW_FINDINGS') }}</th>
4950
<th class="background-color">{{ $t('REPORT_INFO_FINDINGS') }}</th>
5051
</tr>
@@ -56,6 +57,7 @@
5657
class="background-color clickable-column"
5758
@click="routeTo(key)">
5859
<td>{{ key }}</td>
60+
<td>{{ scanType.total }}</td>
5961
<td>{{ scanType.critical }}</td>
6062
<td>{{ scanType.high }}</td>
6163
<td>{{ scanType.medium }}</td>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
/>
77
<v-toolbar color="background_paper">
88
<v-toolbar-title>
9-
{{ scanType }}
109
{{ jobUUID }}
10+
{{ scanType }}
1111
</v-toolbar-title>
1212
<v-icon
1313
icon="mdi-circle"

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

+84-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
fixed-header
88
>
99
<tbody class="sechub-primary-color">
10-
<tr><th>{{ $t('REPORT_DESCRIPTION_NAME')}}</th>
10+
<tr>
1111
<th>{{ $t('REPORT_DESCRIPTION_LOCATION')}}</th>
1212
<th>{{ $t('REPORT_DESCRIPTION_ATTACK_VECTOR')}}</th>
1313
<th>{{ $t('REPORT_DESCRIPTION_EVIDENCE')}}</th>
@@ -16,7 +16,6 @@
1616

1717
<tbody>
1818
<tr>
19-
<td>{{ item.name }}</td>
2019
<td>{{ webItem.request?.target }}</td>
2120
<td>{{ webItem.attack?.vector }}</td>
2221
<td>{{ webItem.attack?.evidence?.snippet }}</td>
@@ -93,7 +92,9 @@
9392
<tr>
9493
<td> {{ $t('REPORT_DETAILS_WEBSCAN_BODY') }}</td>
9594
<td>
96-
{{ webItem.request?.body }}
95+
<pre>
96+
{{ formatJson(webItem.request?.body?.text || '{}') }}
97+
</pre>
9798
</td>
9899
</tr>
99100
</tbody>
@@ -125,9 +126,64 @@
125126
</td>
126127
</tr>
127128
</tbody>
129+
130+
<tbody v-if="isExpanded.reportDetails">
131+
<tr>
132+
<td> {{ $t('REPORT_DETAILS_WEBSCAN_HEADERS') }}</td>
133+
<td>
134+
<v-list lines="two"
135+
class="background-color">
136+
<v-list-item
137+
class="background-color ma-0 pa-0"
138+
v-for="(header, i) in webItem.response?.headers">
139+
<spa>{{ i }}</spa>: <span>{{ header }}</span>
140+
141+
</v-list-item>
142+
</v-list>
143+
</td>
144+
</tr>
145+
</tbody>
146+
147+
<tbody v-if="isExpanded.reportDetails"
148+
class="background-color-light ">
149+
<tr>
150+
<td> {{ $t('REPORT_DETAILS_WEBSCAN_BODY') }}</td>
151+
<td>
152+
<pre>
153+
{{ formatJson(webItem.response?.body?.text || '{}') }}
154+
</pre>
155+
</td>
156+
</tr>
157+
</tbody>
128158
</v-table>
129159
</div>
130160

161+
<!-- Description Table -->
162+
<div>
163+
<v-table
164+
class="background-color sechub-report-expandable-element"
165+
fixed-header
166+
>
167+
<tbody class="sechub-primary-color">
168+
<tr>
169+
<v-btn
170+
:append-icon="isExpanded.description ? 'mdi-chevron-up' : 'mdi-chevron-down'"
171+
:text="isExpanded.description ? $t('REPORT_DESCRIPTION_HIDE') : $t('REPORT_DESCRIPTION_SHOW')"
172+
class="text-none background-color ma-2"
173+
color="primary"
174+
variant="text"
175+
@click="toggleExpand('description')">
176+
</v-btn>
177+
</tr>
178+
</tbody>
179+
<tbody v-if="isExpanded.description">
180+
<tr>
181+
<td> {{ item.description }} </td>
182+
</tr>
183+
</tbody>
184+
</v-table>
185+
</div>
186+
131187
<!-- Solution Table -->
132188
<div>
133189
<v-table
@@ -162,7 +218,6 @@
162218
import { getTrafficLightClass } from '@/utils/projectUtils'
163219
import { SecHubFinding, SecHubReportWeb } from '@/generated-sources/openapi'
164220
import '@/styles/sechub.scss'
165-
import { it } from 'vuetify/locale'
166221

167222
interface Props {
168223
item: SecHubFinding
@@ -171,7 +226,7 @@ interface Props {
171226
interface ExpandedState {
172227
reportDetails: boolean;
173228
solution: boolean;
174-
table3: boolean;
229+
description: boolean;
175230
}
176231

177232
export default defineComponent({
@@ -191,19 +246,41 @@ export default defineComponent({
191246
const isExpanded = ref<ExpandedState>({
192247
reportDetails: false,
193248
solution: false,
194-
table3: false,
249+
description: false,
195250
})
196251

197252
const toggleExpand = (table: keyof ExpandedState) => {
198253
isExpanded.value[table] = !isExpanded.value[table]
199254
}
255+
256+
function formatJson(jsonString: string) {
257+
console.log(jsonString)
258+
try {
259+
const jsonObj = JSON.parse(jsonString)
260+
return JSON.stringify(jsonObj, null, 2)
261+
} catch (error) {
262+
return jsonString
263+
}
264+
}
265+
200266
return {
201267
getTrafficLightClass,
202268
toggleExpand,
269+
formatJson,
203270
item,
204271
webItem,
205272
isExpanded,
206273
}
207274
},
208275
})
209-
</script>
276+
</script>
277+
<style scoped>
278+
pre {
279+
word-wrap: break-word;
280+
width: 100%;
281+
margin: 0;
282+
display: inline;
283+
text-align: left;
284+
white-space: pre-line;
285+
}
286+
</style>

0 commit comments

Comments
 (0)