aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/security-standard.ts
diff options
context:
space:
mode:
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(