Skip to content

Commit a76ceca

Browse files
fix SonarQube mapping for rule java:S4790 (#156)
1 parent df967df commit a76ceca

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

plugin/src/main/java/org/owasp/benchmarkutils/score/parsers/SonarQubeReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ public static int cweLookup(String squidNumber) {
516516
// with secure mode and padding scheme
517517
case "S5547":
518518
case "S4790":
519-
return CweNumber
520-
.WEAK_CRYPTO_ALGO; // Benchmark Vuln: Cipher algorithms should be robust
519+
// Using weak hashing algorithms is security-sensitive
520+
return CweNumber.WEAK_HASH_ALGO;
521521
case "S3330":
522522
return CweNumber.COOKIE_WITHOUT_HTTPONLY;
523523

plugin/src/test/java/org/owasp/benchmarkutils/score/parsers/SonarQubeJsonReaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ void readerHandlesGivenV25ResultFile() throws Exception {
7878
assertEquals(2, result.getTotalResults());
7979

8080
assertEquals(CweNumber.SQL_INJECTION, result.get(1).get(0).getCWE());
81-
assertEquals(CweNumber.WEAK_CRYPTO_ALGO, result.get(2).get(0).getCWE());
81+
assertEquals(CweNumber.WEAK_HASH_ALGO, result.get(2).get(0).getCWE());
8282
}
8383
}

plugin/src/test/resources/testfiles/Benchmark_sonarqube-v25.1.0.102122.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@
2020
"line": 57,
2121
"description": "Formatting SQL queries is security-sensitive",
2222
"message": "Make sure using a dynamically formatted SQL query is safe here.",
23-
"key": "e1518810-c118-4cad-ae23-f337cf913d65"
23+
"key": "11111111-1111-1111-1111-111111111111"
2424
},
2525
{
26-
"rule": "java:S5547",
27-
"severity": "CRITICAL",
28-
"status": "OPEN",
26+
"rule": "java:S4790",
27+
"severity": "MINOR",
28+
"status": "TO_REVIEW",
2929
"component": "src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00002.java",
30-
"line": 72,
31-
"description": "Cipher algorithms should be robust",
32-
"message": "Use a strong cipher algorithm.",
33-
"key": "ffecce86-2afe-4fe3-b5b2-f06e24d549db"
30+
"line": 50,
31+
"description": "Using weak hashing algorithms is security-sensitive",
32+
"message": "Make sure this weak hash algorithm is not used in a sensitive context here.",
33+
"key": "22222222-2222-2222-2222-222222222222"
3434
}
3535
],
3636
"hotspotKeys": [
37-
"9012d4af-be33-4e0d-8c68-705d8fef08c4",
38-
"0c0fbd12-b778-44b8-a0f6-dbfa9afc0872"
37+
"11111111-1111-1111-1111-111111111111",
38+
"22222222-2222-2222-2222-222222222222"
3939
],
4040
"deltaAnalysis": "No",
4141
"qualityGateStatus": false,
4242
"summary": {
4343
"blocker": 0,
44-
"critical": 1015,
45-
"major": 3072,
46-
"minor": 6613
44+
"critical": 1,
45+
"major": 2,
46+
"minor": 3
4747
}
4848
}

0 commit comments

Comments
 (0)