Skip to content

Commit 5148873

Browse files
committed
#68 - take first CWE number from tags
1 parent f2eec0d commit 5148873

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public int mapCwe(int cwe) {
3434
return CweNumber.COMMAND_INJECTION; // Command Injection
3535
case 335: // java/predictable-seed - Improves the tool's score
3636
return CweNumber.WEAK_RANDOM; // Weak Random
37-
case 564:
38-
return CweNumber.SQL_INJECTION;
3937
}
4038
return cwe;
4139
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ private Map<String, Integer> ruleCweMappingsByTag(JSONObject tool) {
159159
for (int j = 0; j < tags.length(); j++) {
160160
String tag = tags.getString(j).toLowerCase();
161161

162-
if (tag.contains("cwe")) {
162+
// only take first CWE id for rule
163+
if (tag.contains("cwe") && !mappings.containsKey(rule.getString("id"))) {
163164
mappings.put(rule.getString("id"), mapCwe(extractCwe(tag)));
164165
}
165166
}

0 commit comments

Comments
 (0)