aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/security-standard.ts
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-03-15 11:04:15 +0100
committersonartech <sonartech@sonarsource.com>2022-03-17 20:03:09 +0000
commit83e4a98dc6c44840d1953b8ac76e52bdd4a81dd5 (patch)
treef8a6da24987c1d64392c0c678e6938d2321aea35 /server/sonar-web/src/main/js/helpers/security-standard.ts
parent4cd2466ed408d5664c88cc05ba6fd8a99f59d055 (diff)
downloadsonarqube-83e4a98dc6c44840d1953b8ac76e52bdd4a81dd5.tar.gz
sonarqube-83e4a98dc6c44840d1953b8ac76e52bdd4a81dd5.zip
SONAR-16130,SONAR-16129 Add UI facet for OWASP 2021 Standards
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/security-standard.ts')
-rw-r--r--server/sonar-web/src/main/js/helpers/security-standard.ts22
1 files changed, 19 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/helpers/security-standard.ts b/server/sonar-web/src/main/js/helpers/security-standard.ts
index 5e17ac8d56e..7a8b78a8ac8 100644
--- a/server/sonar-web/src/main/js/helpers/security-standard.ts
+++ b/server/sonar-web/src/main/js/helpers/security-standard.ts
@@ -39,12 +39,28 @@ export function renderOwaspTop10Category(
category: string,
withPrefix = false
): string {
- const record = standards.owaspTop10[category];
+ return renderOwaspCategory('owaspTop10', standards, category, withPrefix);
+}
+
+export function renderOwaspTop102021Category(
+ standards: Standards,
+ category: string,
+ withPrefix = false
+): string {
+ return renderOwaspCategory('owaspTop10-2021', standards, category, withPrefix);
+}
+
+function renderOwaspCategory(
+ type: 'owaspTop10' | 'owaspTop10-2021',
+ standards: Standards,
+ category: string,
+ withPrefix: boolean
+) {
+ const record = standards[type][category];
if (!record) {
return addPrefix(category.toUpperCase(), 'OWASP', withPrefix);
- } else {
- return addPrefix(`${category.toUpperCase()} - ${record.title}`, 'OWASP', withPrefix);
}
+ return addPrefix(`${category.toUpperCase()} - ${record.title}`, 'OWASP', withPrefix);
}
export function renderSansTop25Category(