aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorMichal Duda <michal.duda@sonarsource.com>2019-06-26 10:19:48 +0200
committerSonarTech <sonartech@sonarsource.com>2019-06-28 20:21:11 +0200
commit87e7d062dda60f63957bccaf94df78633b525ac0 (patch)
tree2612154cbda08c7f22b72b6779cbcfd9dc1ada01 /server/sonar-web/src/main
parentcb7020fd904e098e11fcd6d80f8a548414f59fe3 (diff)
downloadsonarqube-87e7d062dda60f63957bccaf94df78633b525ac0.tar.gz
sonarqube-87e7d062dda60f63957bccaf94df78633b525ac0.zip
SONAR-12023 Remove "Not OWASP" CWE mapping, and move all unmapped CWEs to "Others" (SonarSource Security)
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx17
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts7
-rw-r--r--server/sonar-web/src/main/js/helpers/security-standard.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/standards.json3
4 files changed, 14 insertions, 21 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx
index 0140d9d8c87..ce603e74fef 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx
@@ -160,25 +160,25 @@ it('should toggle sub-facets', () => {
it('should display correct selection', () => {
const wrapper = shallowRender({
open: true,
- owaspTop10: ['a1', 'a3', 'unknown'],
+ owaspTop10: ['a1', 'a3'],
sansTop25: ['risky-resource', 'foo'],
cwe: ['42', '1111', 'unknown'],
- sonarsourceSecurity: ['sql-injection']
+ sonarsourceSecurity: ['sql-injection', 'others']
});
checkValues('standards', [
'SONAR SQL Injection',
+ 'Others',
'OWASP A1 - a1 title',
'OWASP A3',
- 'Not OWAPS',
'SANS Risky Resource Management',
'SANS foo',
'CWE-42 - cwe-42 title',
'CWE-1111',
'Unknown CWE'
]);
- checkValues('owaspTop10', ['A1 - a1 title', 'A3', 'Not OWAPS']);
+ checkValues('owaspTop10', ['A1 - a1 title', 'A3']);
checkValues('sansTop25', ['Risky Resource Management', 'foo']);
- checkValues('sonarsourceSecurity', ['SQL Injection']);
+ checkValues('sonarsourceSecurity', ['SQL Injection', 'Others']);
function checkValues(property: string, values: string[]) {
expect(
@@ -219,10 +219,13 @@ function shallowRender(props: Partial<StandardFacet['props']> = {}) {
);
wrapper.setState({
standards: {
- owaspTop10: { a1: { title: 'a1 title' }, unknown: { title: 'Not OWAPS' } },
+ owaspTop10: { a1: { title: 'a1 title' } },
sansTop25: { 'risky-resource': { title: 'Risky Resource Management' } },
cwe: { 42: { title: 'cwe-42 title' }, unknown: { title: 'Unknown CWE' } },
- sonarsourceSecurity: { 'sql-injection': { title: 'SQL Injection' } }
+ sonarsourceSecurity: {
+ 'sql-injection': { title: 'SQL Injection' },
+ others: { title: 'Others' }
+ }
}
});
return wrapper;
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
index 18d5e62ba4f..738cba85e1e 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
@@ -53,9 +53,6 @@ describe('renderOwaspTop10Category', () => {
owaspTop10: {
a1: {
title: 'Injection'
- },
- unknown: {
- title: 'Not OWASP'
}
},
sansTop25: {},
@@ -66,8 +63,6 @@ describe('renderOwaspTop10Category', () => {
expect(renderOwaspTop10Category(standards, 'a1', true)).toEqual('OWASP A1 - Injection');
expect(renderOwaspTop10Category(standards, 'a2')).toEqual('A2');
expect(renderOwaspTop10Category(standards, 'a2', true)).toEqual('OWASP A2');
- expect(renderOwaspTop10Category(standards, 'unknown')).toEqual('Not OWASP');
- expect(renderOwaspTop10Category(standards, 'unknown', true)).toEqual('Not OWASP');
});
});
@@ -115,8 +110,6 @@ describe('renderSonarSourceSecurityCategory', () => {
expect(renderSonarSourceSecurityCategory(standards, 'xss', true)).toEqual(
'SONAR Cross-Site Scripting (XSS)'
);
- expect(renderSonarSourceSecurityCategory(standards, 'unknown')).toEqual('unknown');
- expect(renderSonarSourceSecurityCategory(standards, 'unknown', true)).toEqual('SONAR unknown');
expect(renderSonarSourceSecurityCategory(standards, 'others')).toEqual('Others');
expect(renderSonarSourceSecurityCategory(standards, 'others', true)).toEqual('Others');
});
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 cc44d1b2226..5e7b2bb0145 100644
--- a/server/sonar-web/src/main/js/helpers/security-standard.ts
+++ b/server/sonar-web/src/main/js/helpers/security-standard.ts
@@ -40,8 +40,6 @@ export function renderOwaspTop10Category(
const record = standards.owaspTop10[category];
if (!record) {
return addPrefix(category.toUpperCase(), 'OWASP', withPrefix);
- } else if (category === 'unknown') {
- return record.title;
} else {
return addPrefix(`${category.toUpperCase()} - ${record.title}`, 'OWASP', withPrefix);
}
@@ -62,10 +60,12 @@ export function renderSonarSourceSecurityCategory(
withPrefix = false
): string {
const record = standards.sonarsourceSecurity[category];
- if (category === 'others') {
+ if (!record) {
+ return addPrefix(category.toUpperCase(), 'SONAR', withPrefix);
+ } else if (category === 'others') {
return record.title;
} else {
- return addPrefix(record ? record.title : category, 'SONAR', withPrefix);
+ return addPrefix(record.title, 'SONAR', withPrefix);
}
}
diff --git a/server/sonar-web/src/main/js/helpers/standards.json b/server/sonar-web/src/main/js/helpers/standards.json
index 051fc01038d..9ab3ece45b7 100644
--- a/server/sonar-web/src/main/js/helpers/standards.json
+++ b/server/sonar-web/src/main/js/helpers/standards.json
@@ -49,9 +49,6 @@
"title": "Insufficient Logging & Monitoring",
"description":
"Insufficient logging and monitoring, coupled with missing or ineffective integration with incident response, allows attackers to further attack systems, maintain persistence, pivot to more systems, and tamper, extract, or destroy data. Most breach studies show time to detect a breach is over 200 days, typically detected by external parties rather than internal processes or monitoring."
- },
- "unknown": {
- "title": "Not OWASP"
}
},
"sansTop25": {