Skip to content

Commit d578485

Browse files
authored
feat: add show more expandable for long descriptions (#288)
* feat: add show more expandable for long descriptions Signed-off-by: Ruben Romero Montes <[email protected]>
1 parent dafaa08 commit d578485

File tree

12 files changed

+7478
-5298
lines changed

12 files changed

+7478
-5298
lines changed

src/main/resources/freemarker/templates/generated/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/freemarker/templates/generated/vendor.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/freemarker/templates/generated/vendor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/freemarker/templates/report.ftl

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
1-
<svg version="1.1" style="display: none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2-
<symbol viewBox="0 0 10.9793322 13" id="shield-icon">
3-
<title>Combined Shape</title>
4-
<g id="New-dependencies-view" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5-
<g id="Overview" transform="translate(-1207.172757, -938.000000)" fill="#3E8635">
6-
<g id="Details-of-dependency-com.github" transform="translate(427.000000, 764.000000)">
7-
<g id="Dependency-1" transform="translate(0.000000, 144.000000)">
8-
<g id="Group-9" transform="translate(780.172757, 24.000000)">
9-
<g id="Group-4" transform="translate(0.000000, 3.200001)">
10-
<g id="Icons/2.-Size-sm/Actions/check" transform="translate(0.000000, 2.799999)">
11-
<path d="M10.5565789,0 C10.7906249,0 10.9793322,0.181542969 10.9793322,0.40625 L10.9793322,5.74082031 C10.9793322,9.75 6.24081907,13 5.49579296,13 C4.75076684,13 0,9.75 0,5.73955078 L0,0.40625 C0,0.181542969 0.188707272,0 0.422753304,0 Z M8.54277883,3.11782667 L4.7912961,6.89087353 L3.03981338,5.1293244 C2.883609,4.97220683 2.63032812,4.97220683 2.47412375,5.1293244 L1.90844938,5.69826556 C1.75224501,5.85538312 1.75224501,6.11010449 1.90844938,6.26720671 L4.50845797,8.88215991 C4.66464708,9.03927747 4.9179127,9.03927747 5.07413233,8.88217525 L9.67414282,4.25570898 C9.8303472,4.09859141 9.8303472,3.84387004 9.67414282,3.68676782 L9.10846846,3.11782667 C8.95226408,2.96072444 8.6989832,2.96072444 8.54277883,3.11782667 Z" id="Combined-Shape"></path>
12-
</g>
13-
</g>
14-
</g>
15-
</g>
16-
</g>
17-
</g>
18-
</g>
19-
</symbol>
20-
</svg>
1+
<!DOCTYPE html>
212
[#function htmlRef package]
223
[#local result = package.name()?replace(".", "")]
234
[#local result = result?replace(":","")]
@@ -43,7 +24,6 @@
4324
[#function vexLink cve]
4425
[#return body.vexPath + cve + "-Quarkus.json" ]
4526
[/#function]
46-
<!DOCTYPE html>
4727
<html lang="en-us">
4828

4929
<head>

src/test/resources/__files/osvnvd/maven_report.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@
436436
"aliases": ["GHSA-jjjh-jjxp-wpff"],
437437
"cveId": "CVE-2022-42003",
438438
"created": "2024-01-15T21:37:47.413+00:00",
439-
"summary": "Uncontrolled Resource Consumption in Jackson-databind",
440439
"description": "In FasterXML jackson-databind 2.4.0-rc1 until 2.12.7.1 and in 2.13.x before 2.13.4.2 resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled. This was patched in 2.12.7.1, 2.13.4.2, and 2.14.0.",
441440
"affected": [
442441
{
@@ -875,7 +874,6 @@
875874
"aliases": ["GHSA-3fhx-3vvg-2j84"],
876875
"cveId": "CVE-2023-2974",
877876
"created": "2024-01-15T21:37:49.155+00:00",
878-
"summary": "quarkus-core vulnerable to client driven TLS cipher downgrading",
879877
"description": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
880878
"affected": [
881879
{

src/test/resources/__files/reports/report_all_token.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
"issues": [
216216
{
217217
"id": "CVE-2023-2974",
218-
"title": "quarkus-core vulnerable to client driven TLS cipher downgrading",
218+
"title": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
219219
"source": "osv-nvd",
220220
"cvss": {
221221
"attackVector": "Network",
@@ -248,7 +248,7 @@
248248
],
249249
"highestVulnerability": {
250250
"id": "CVE-2023-2974",
251-
"title": "quarkus-core vulnerable to client driven TLS cipher downgrading",
251+
"title": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
252252
"source": "osv-nvd",
253253
"cvss": {
254254
"attackVector": "Network",
@@ -284,7 +284,7 @@
284284
"issues": [
285285
{
286286
"id": "CVE-2022-42003",
287-
"title": "Uncontrolled Resource Consumption in Jackson-databind",
287+
"title": "In FasterXML jackson-databind 2.4.0-rc1 until 2.12.7.1 and in 2.13.x before 2.13.4.2 resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled. This was patched in 2.12.7.1, 2.13.4.2, and 2.14.0.",
288288
"source": "osv-nvd",
289289
"cvss": {
290290
"attackVector": "Network",
@@ -372,7 +372,7 @@
372372
],
373373
"highestVulnerability": {
374374
"id": "CVE-2022-42003",
375-
"title": "Uncontrolled Resource Consumption in Jackson-databind",
375+
"title": "In FasterXML jackson-databind 2.4.0-rc1 until 2.12.7.1 and in 2.13.x before 2.13.4.2 resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled. This was patched in 2.12.7.1, 2.13.4.2, and 2.14.0.",
376376
"source": "osv-nvd",
377377
"cvss": {
378378
"attackVector": "Network",
@@ -403,7 +403,7 @@
403403
"recommendation": "pkg:maven/io.quarkus/[email protected]?repository_url=https%3A%2F%2Fmaven.repository.redhat.com%2Fga%2F&type=jar",
404404
"highestVulnerability": {
405405
"id": "CVE-2023-2974",
406-
"title": "quarkus-core vulnerable to client driven TLS cipher downgrading",
406+
"title": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
407407
"source": "osv-nvd",
408408
"cvss": {
409409
"attackVector": "Network",

src/test/resources/__files/reports/v3/report_all_token.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"issues": [
181181
{
182182
"id": "CVE-2023-2974",
183-
"title": "quarkus-core vulnerable to client driven TLS cipher downgrading",
183+
"title": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
184184
"source": "osv-nvd",
185185
"cvss": {
186186
"attackVector": "Network",
@@ -210,7 +210,7 @@
210210
},
211211
"highestVulnerability": {
212212
"id": "CVE-2023-2974",
213-
"title": "quarkus-core vulnerable to client driven TLS cipher downgrading",
213+
"title": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
214214
"source": "osv-nvd",
215215
"cvss": {
216216
"attackVector": "Network",
@@ -236,7 +236,7 @@
236236
"issues": [
237237
{
238238
"id": "CVE-2022-42003",
239-
"title": "Uncontrolled Resource Consumption in Jackson-databind",
239+
"title": "In FasterXML jackson-databind 2.4.0-rc1 until 2.12.7.1 and in 2.13.x before 2.13.4.2 resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled. This was patched in 2.12.7.1, 2.13.4.2, and 2.14.0.",
240240
"source": "osv-nvd",
241241
"cvss": {
242242
"attackVector": "Network",
@@ -308,7 +308,7 @@
308308
},
309309
"highestVulnerability": {
310310
"id": "CVE-2022-42003",
311-
"title": "Uncontrolled Resource Consumption in Jackson-databind",
311+
"title": "In FasterXML jackson-databind 2.4.0-rc1 until 2.12.7.1 and in 2.13.x before 2.13.4.2 resource exhaustion can occur because of a lack of a check in primitive value deserializers to avoid deep wrapper array nesting, when the UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled. This was patched in 2.12.7.1, 2.13.4.2, and 2.14.0.",
312312
"source": "osv-nvd",
313313
"cvss": {
314314
"attackVector": "Network",
@@ -333,7 +333,7 @@
333333
"recommendation": "pkg:maven/io.quarkus/[email protected]?repository_url=https%3A%2F%2Fmaven.repository.redhat.com%2Fga%2F&type=jar",
334334
"highestVulnerability": {
335335
"id": "CVE-2023-2974",
336-
"title": "quarkus-core vulnerable to client driven TLS cipher downgrading",
336+
"title": "A vulnerability was found in quarkus-core. This vulnerability occurs because the TLS protocol configured with quarkus.http.ssl.protocols is not enforced, and the client can force the selection of the weaker supported TLS protocol.",
337337
"source": "osv-nvd",
338338
"cvss": {
339339
"attackVector": "Network",

ui/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@patternfly/react-charts": "^5.0.0",
7-
"@patternfly/react-core": "^5.0.0",
8-
"@patternfly/react-table": "^5.0.0",
6+
"@patternfly/react-charts": "7.3.0-prerelease.1",
7+
"@patternfly/react-core": "^5.2.0",
8+
"@patternfly/react-table": "^5.2.0",
99
"@testing-library/jest-dom": "^5.14.1",
1010
"@testing-library/react": "^13.0.0",
1111
"@testing-library/user-event": "^13.2.1",
@@ -19,6 +19,10 @@
1919
"typescript": "^4.4.2",
2020
"web-vitals": "^2.1.0"
2121
},
22+
"resolutions": {
23+
"@patternfly/react-styles": "^5.2.0",
24+
"@patternfly/react-tokens": "^5.2.0"
25+
},
2226
"scripts": {
2327
"start": "craco start",
2428
"build": "craco build && yarn copy:js:main && yarn copy:js:vendor && yarn copy:css:main && yarn copy:css:vendor",

ui/src/components/VulnerabilityRow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { usePrivateIssueHelper } from "../hooks/usePrivateDataHelper";
88
import { hasRemediations, VulnerabilityItem } from "../api/report";
99
import { useAppContext } from '../App';
1010
import { VulnerabilityIdLink } from './VulnerabilityIdLink';
11+
import { VulnerabilityTitle } from './VulnerabilityTitle';
1112

1213
interface VulnerabilityRowProps {
1314
item: VulnerabilityItem;
@@ -42,7 +43,7 @@ export const VulnerabilityRow: React.FC<VulnerabilityRowProps> = ({item, provide
4243
<p key={index}><VulnerabilityIdLink id={id}/></p>
4344
))}
4445
</Td>
45-
<Td>{item.vulnerability.title}</Td>
46+
<Td><VulnerabilityTitle title={item.vulnerability.title}/></Td>
4647
<Td noPadding>
4748
<VulnerabilitySeverityLabel vulnerability={item.vulnerability}/>
4849
</Td>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { ExpandableSection, ExpandableSectionVariant } from '@patternfly/react-core';
2+
import React from 'react';
3+
4+
export const VulnerabilityTitle = ({ title }: { title: string }) => {
5+
6+
const [isExpanded, setIsExpanded] = React.useState(false);
7+
const onToggle = (_event: React.MouseEvent, isExpanded: boolean) => {
8+
setIsExpanded(isExpanded);
9+
};
10+
11+
return (
12+
<ExpandableSection
13+
variant={ExpandableSectionVariant.truncate}
14+
toggleText={isExpanded ? 'Show less' : 'Show more'}
15+
onToggle={onToggle}
16+
isExpanded={isExpanded}>
17+
{title}
18+
</ExpandableSection>
19+
)
20+
};

0 commit comments

Comments
 (0)