]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17399 Adding level selector for OWASP ASVS
authorRevanshu Paliwal <revanshu.paliwal@sonarsource.com>
Wed, 5 Oct 2022 13:31:57 +0000 (15:31 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 10 Oct 2022 20:03:09 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/IssuesApp-test.tsx.snap
server/sonar-web/src/main/js/apps/issues/utils.ts
server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
server/sonar-web/src/main/js/helpers/urls.ts

index 2f23a97d038765216ac00c0b0424adeb42718a2a..3b2c8a7c5dca04fa983ce61b3053b779febd98f6 100644 (file)
@@ -54,6 +54,7 @@ describe('serialize/deserialize', () => {
         'pciDss-3.2': ['a', 'b'],
         'pciDss-4.0': ['a', 'b'],
         'owaspAsvs-4.0': ['2'],
+        owaspAsvsLevel: '2',
         projects: ['a', 'b'],
         resolutions: ['a', 'b'],
         resolved: true,
@@ -85,6 +86,7 @@ describe('serialize/deserialize', () => {
       'pciDss-3.2': 'a,b',
       'pciDss-4.0': 'a,b',
       'owaspAsvs-4.0': '2',
+      owaspAsvsLevel: '2',
       projects: 'a,b',
       resolutions: 'a,b',
       rules: 'a,b',
index 31fcf90c9f7e158b4d610a1d866141152e121f75..0be1d5defdf12d77bc65d731311f72d1cbb68d26 100644 (file)
@@ -119,6 +119,7 @@ exports[`should show warnning when not all projects are accessible 1`] = `
               "issues": Array [],
               "languages": Array [],
               "owaspAsvs-4.0": Array [],
+              "owaspAsvsLevel": "",
               "owaspTop10": Array [],
               "owaspTop10-2021": Array [],
               "pciDss-3.2": Array [],
index 9eac3657ed8da3fd506896222985641d73ea0a0a..cd77fa72956e338b5ebf9642740f94b92e4b10c3 100644 (file)
@@ -58,6 +58,7 @@ export interface Query {
   'pciDss-3.2': string[];
   'pciDss-4.0': string[];
   [OWASP_ASVS_4_0]: string[];
+  owaspAsvsLevel: string;
   projects: string[];
   resolutions: string[];
   resolved: boolean;
@@ -99,6 +100,7 @@ export function parseQuery(query: RawQuery): Query {
     'pciDss-3.2': parseAsArray(query['pciDss-3.2'], parseAsString),
     'pciDss-4.0': parseAsArray(query['pciDss-4.0'], parseAsString),
     [OWASP_ASVS_4_0]: parseAsArray(query[OWASP_ASVS_4_0], parseAsString),
+    owaspAsvsLevel: parseAsString(query['owaspAsvsLevel']),
     projects: parseAsArray(query.projects, parseAsString),
     resolutions: parseAsArray(query.resolutions, parseAsString),
     resolved: parseAsBoolean(query.resolved),
@@ -144,6 +146,7 @@ export function serializeQuery(query: Query): RawQuery {
     'pciDss-3.2': serializeStringArray(query['pciDss-3.2']),
     'pciDss-4.0': serializeStringArray(query['pciDss-4.0']),
     [OWASP_ASVS_4_0]: serializeStringArray(query[OWASP_ASVS_4_0]),
+    owaspAsvsLevel: serializeString(query['owaspAsvsLevel']),
     projects: serializeStringArray(query.projects),
     resolutions: serializeStringArray(query.resolutions),
     resolved: query.resolved ? undefined : 'false',
index d4669b900650936eaffab6f9225071b0ad999b15..60206865f5c227dd5ac2973473cb06cd0f7ebffd 100644 (file)
@@ -341,6 +341,8 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
         hotspotFilters.files = filterByFile;
       }
 
+      hotspotFilters['owaspAsvsLevel'] = location.query['owaspAsvsLevel'];
+
       return getSecurityHotspots({
         ...hotspotFilters,
         projectKey: component.key,
index c7d6cffd444e09ba2cdd7f4466e7304f9c95748a..d8ccb3ecb8bba2067e52c7e8da7a1972d88eafdb 100644 (file)
@@ -214,7 +214,8 @@ export function getComponentSecurityHotspotsUrl(componentKey: string, query: Que
         SecurityStandard.CWE,
         SecurityStandard.PCI_DSS_3_2,
         SecurityStandard.PCI_DSS_4_0,
-        SecurityStandard.OWASP_ASVS_4_0
+        SecurityStandard.OWASP_ASVS_4_0,
+        'owaspAsvsLevel'
       ])
     }),
     hash: ''