From e9494f3e121102ff5ede94eda6bf142e16dfc0fd Mon Sep 17 00:00:00 2001 From: Revanshu Paliwal Date: Thu, 29 Sep 2022 12:08:27 +0200 Subject: SONAR-17393 Add new security tab for OWASP ASVS --- .../src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx | 4 +++- .../__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap | 1 + .../__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap | 10 ++++++++++ .../components/__tests__/HotspotSimpleList-test.tsx | 3 ++- server/sonar-web/src/main/js/apps/security-hotspots/utils.ts | 7 +++++-- 5 files changed, 21 insertions(+), 4 deletions(-) (limited to 'server/sonar-web/src/main/js/apps/security-hotspots') diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx index 260afe05f41..d4669b90065 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx @@ -99,7 +99,8 @@ export class SecurityHotspotsApp extends React.PureComponent { [SecurityStandard.SONARSOURCE]: {}, [SecurityStandard.CWE]: {}, [SecurityStandard.PCI_DSS_3_2]: {}, - [SecurityStandard.PCI_DSS_4_0]: {} + [SecurityStandard.PCI_DSS_4_0]: {}, + [SecurityStandard.OWASP_ASVS_4_0]: {} }, filters: { ...this.constructFiltersFromProps(props), @@ -454,6 +455,7 @@ export class SecurityHotspotsApp extends React.PureComponent { [SecurityStandard.OWASP_TOP10_2021]: undefined, [SecurityStandard.PCI_DSS_3_2]: undefined, [SecurityStandard.PCI_DSS_4_0]: undefined, + [SecurityStandard.OWASP_ASVS_4_0]: undefined, file: undefined } }); diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap index 4b6a0206bfb..1891d1068b1 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsApp-test.tsx.snap @@ -56,6 +56,7 @@ exports[`should render correctly 1`] = ` standards={ Object { "cwe": Object {}, + "owaspAsvs-4.0": Object {}, "owaspTop10": Object {}, "owaspTop10-2021": Object {}, "pciDss-3.2": Object {}, diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap index 9a9fc621891..6e3c4c9c0db 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/__snapshots__/SecurityHotspotsAppRenderer-test.tsx.snap @@ -145,6 +145,11 @@ exports[`should render correctly when filtered by category or cwe: category 1`] "title": "No CWE associated", }, }, + "owaspAsvs-4.0": Object { + "1": Object { + "title": "New OWASP ASVS cat 1", + }, + }, "owaspTop10": Object { "a1": Object { "title": "Injection", @@ -286,6 +291,11 @@ exports[`should render correctly when filtered by category or cwe: cwe 1`] = ` "title": "No CWE associated", }, }, + "owaspAsvs-4.0": Object { + "1": Object { + "title": "New OWASP ASVS cat 1", + }, + }, "owaspTop10": Object { "a1": Object { "title": "Injection", diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx index 9a660270786..29a57bf93fb 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx @@ -79,7 +79,8 @@ function shallowRender(props: Partial = {}) { sansTop25: {}, sonarsourceSecurity: {}, 'pciDss-3.2': {}, - 'pciDss-4.0': {} + 'pciDss-4.0': {}, + 'owaspAsvs-4.0': {} }} {...props} /> diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts b/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts index 02f28614fd0..e425b2e8d94 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts +++ b/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts @@ -20,6 +20,7 @@ import { flatten, groupBy, sortBy } from 'lodash'; import { renderCWECategory, + renderOwaspAsvs40Category, renderOwaspTop102021Category, renderOwaspTop10Category, renderPciDss32Category, @@ -56,7 +57,8 @@ export const SECURITY_STANDARDS = [ SecurityStandard.SANS_TOP25, SecurityStandard.CWE, SecurityStandard.PCI_DSS_3_2, - SecurityStandard.PCI_DSS_4_0 + SecurityStandard.PCI_DSS_4_0, + SecurityStandard.OWASP_ASVS_4_0 ]; export const SECURITY_STANDARD_RENDERER = { @@ -66,7 +68,8 @@ export const SECURITY_STANDARD_RENDERER = { [SecurityStandard.SONARSOURCE]: renderSonarSourceSecurityCategory, [SecurityStandard.CWE]: renderCWECategory, [SecurityStandard.PCI_DSS_3_2]: renderPciDss32Category, - [SecurityStandard.PCI_DSS_4_0]: renderPciDss40Category + [SecurityStandard.PCI_DSS_4_0]: renderPciDss40Category, + [SecurityStandard.OWASP_ASVS_4_0]: renderOwaspAsvs40Category }; export function mapRules(rules: Array<{ key: string; name: string }>): Dict { -- cgit v1.2.3