Skip to content

Commit 382990b

Browse files
committed
Merge branch 'main' into feature/command-line-tests and resolve merge conflicts.
2 parents b9bddf6 + db7f69a commit 382990b

32 files changed

+1083
-139
lines changed

.mvn/jvm.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
22
--add-opens java.base/java.lang=ALL-UNNAMED
33

4+
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
5+
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
6+
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
7+
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
8+
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

plugin/pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>com.google.guava</groupId>
5555
<artifactId>guava</artifactId>
56-
<version>33.3.1-jre</version>
56+
<version>33.4.8-jre</version>
5757
</dependency>
5858

5959
<!-- The following dependency might be an upgrade/replacement for jaxb.xml.bind.JAXBContext,
@@ -79,7 +79,7 @@
7979
<dependency>
8080
<groupId>commons-io</groupId>
8181
<artifactId>commons-io</artifactId>
82-
<version>2.18.0</version>
82+
<version>2.19.0</version>
8383
</dependency>
8484

8585
<dependency>
@@ -91,7 +91,7 @@
9191
<dependency>
9292
<groupId>org.apache.commons</groupId>
9393
<artifactId>commons-csv</artifactId>
94-
<version>1.12.0</version>
94+
<version>1.14.0</version>
9595
</dependency>
9696

9797
<dependency>
@@ -103,13 +103,13 @@
103103
<dependency>
104104
<groupId>org.apache.httpcomponents.client5</groupId>
105105
<artifactId>httpclient5</artifactId>
106-
<version>5.4.1</version>
106+
<version>5.5</version>
107107
</dependency>
108108

109109
<dependency>
110110
<groupId>org.apache.httpcomponents.core5</groupId>
111111
<artifactId>httpcore5</artifactId>
112-
<version>5.3.1</version>
112+
<version>5.3.4</version>
113113
</dependency>
114114

115115
<dependency>
@@ -134,19 +134,19 @@
134134
<dependency>
135135
<groupId>org.jfree</groupId>
136136
<artifactId>jfreechart</artifactId>
137-
<version>1.5.5</version>
137+
<version>1.5.6</version>
138138
</dependency>
139139

140140
<dependency>
141141
<groupId>org.json</groupId>
142142
<artifactId>json</artifactId>
143-
<version>20240303</version>
143+
<version>20250517</version>
144144
</dependency>
145145

146146
<dependency>
147147
<groupId>org.yaml</groupId>
148148
<artifactId>snakeyaml</artifactId>
149-
<version>2.3</version>
149+
<version>2.4</version>
150150
</dependency>
151151

152152
<dependency>
@@ -193,10 +193,10 @@
193193
</build>
194194

195195
<properties>
196-
<version.fasterxml.jackson>2.18.2</version.fasterxml.jackson>
196+
<version.fasterxml.jackson>2.19.0</version.fasterxml.jackson>
197197
<!-- 3.0.3+ version of eclipse.persistence requires jakarta.xml.bind instead of jaxb -->
198198
<version.eclipse.persistence>2.7.15</version.eclipse.persistence>
199-
<version.junit.jupiter>5.11.3</version.junit.jupiter>
199+
<version.junit.jupiter>5.12.2</version.junit.jupiter>
200200
</properties>
201201

202202
</project>

plugin/src/main/java/org/owasp/benchmarkutils/helpers/Utils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ public static List<String> getLinesFromStream(InputStream fileStream, String sou
206206
* @throws TestCaseRequestFileParseException
207207
*/
208208
public static TestSuite parseHttpFile(File file)
209-
throws JAXBException, FileNotFoundException, SAXException,
209+
throws JAXBException,
210+
FileNotFoundException,
211+
SAXException,
210212
ParserConfigurationException {
211213

212214
// Disable XXE
@@ -439,7 +441,9 @@ public static String objectToJson(Object object) throws JAXBException {
439441

440442
public static TestCaseVerificationResultsCollection jsonToTestCaseVerificationResultsList(
441443
File file)
442-
throws JAXBException, FileNotFoundException, SAXException,
444+
throws JAXBException,
445+
FileNotFoundException,
446+
SAXException,
443447
ParserConfigurationException {
444448

445449
// Disable XXE

plugin/src/main/java/org/owasp/benchmarkutils/score/BenchmarkScore.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ private static ToolResults calculateMetrics(Map<String, TP_FN_TN_FP_Counts> resu
620620
// c.tp & c.fp can both be zero, creating a precision of NaN. So set to 0.0.
621621
if (Double.isNaN(precision)) precision = 0.0;
622622
double tpr = (double) c.tp / (double) (c.tp + c.fn);
623+
// c.tp & c.fn can both be zero, creating an tpr of NaN. So set to 0.0.
624+
if (Double.isNaN(tpr)) tpr = 0.0;
623625
double fpr = (double) c.fp / (double) (c.fp + c.tn);
624626
// c.fp & c.tn can both be zero, creating an fpr of NaN. So set to 0.0.
625627
if (Double.isNaN(fpr)) fpr = 0.0;

plugin/src/main/java/org/owasp/benchmarkutils/score/CweNumber.java

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,168 +19,171 @@
1919

2020
public class CweNumber {
2121

22+
/** Used occasionally to indicate a CWE isn't mapped yet, but might get mapped properly later */
23+
public static final int UNMAPPED = -1;
24+
2225
/** To be used when the CWE reported is one we don't care about in any test suite */
23-
public static int DONTCARE = 0000;
26+
public static final int DONTCARE = 0000;
2427

2528
/** CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') */
26-
public static int PATH_TRAVERSAL = 22;
29+
public static final int PATH_TRAVERSAL = 22;
2730

2831
/** CWE-23: Relative Path Traversal */
29-
public static int RELATIVE_PATH_TRAVERSAL = 23;
32+
public static final int RELATIVE_PATH_TRAVERSAL = 23;
3033

3134
/**
3235
* CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command
3336
* Injection')
3437
*/
35-
public static int COMMAND_INJECTION = 78;
38+
public static final int COMMAND_INJECTION = 78;
3639

3740
/**
3841
* CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
3942
*/
40-
public static int XSS = 79;
43+
public static final int XSS = 79;
4144

4245
/**
4346
* CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
4447
*/
45-
public static int SQL_INJECTION = 89;
48+
public static final int SQL_INJECTION = 89;
4649

4750
/**
4851
* CWE-90: Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection')
4952
*/
50-
public static int LDAP_INJECTION = 90;
53+
public static final int LDAP_INJECTION = 90;
5154

5255
/** CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') */
53-
public static int CRLF_INJECTION = 93;
56+
public static final int CRLF_INJECTION = 93;
5457

5558
/**
5659
* CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response
5760
* Splitting')
5861
*/
59-
public static int HTTP_RESPONSE_SPLITTING = 113;
62+
public static final int HTTP_RESPONSE_SPLITTING = 113;
6063

6164
/** CWE-134: Use of Externally-Controlled Format String */
62-
public static int EXTERNALLY_CONTROLLED_STRING = 134;
65+
public static final int EXTERNALLY_CONTROLLED_STRING = 134;
6366

6467
/** CWE-284: Improper Access Control */
65-
public static int IMPROPER_ACCESS_CONTROL = 284;
68+
public static final int IMPROPER_ACCESS_CONTROL = 284;
6669

6770
/** CWE-327: Use of a Broken or Risky Cryptographic Algorithm */
68-
public static int WEAK_CRYPTO_ALGO = 327;
71+
public static final int WEAK_CRYPTO_ALGO = 327;
6972

7073
/** CWE-328: Use of Weak Hash */
71-
public static int WEAK_HASH_ALGO = 328;
74+
public static final int WEAK_HASH_ALGO = 328;
7275

7376
/** CWE-329: Generation of Predictable IV with CBC Mode */
74-
public static int STATIC_CRYPTO_INIT = 329;
77+
public static final int STATIC_CRYPTO_INIT = 329;
7578

7679
/** CWE-330: Use of Insufficiently Random Values */
77-
public static int WEAK_RANDOM = 330;
80+
public static final int WEAK_RANDOM = 330;
7881

7982
/** CWE-352: Cross-Site Request Forgery (CSRF) */
80-
public static int CSRF = 352;
83+
public static final int CSRF = 352;
8184

8285
/** CWE-382: J2EE Bad Practices: Use of System.exit() */
83-
public static int SYSTEM_EXIT = 382;
86+
public static final int SYSTEM_EXIT = 382;
8487

8588
/** CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference */
86-
public static int CATCHING_NULL_POINTER_EXCEPTION = 395;
89+
public static final int CATCHING_NULL_POINTER_EXCEPTION = 395;
8790

8891
/** CWE-396: Declaration of Catch for Generic Exception */
89-
public static int CATCH_GENERIC_EXCEPTION = 396;
92+
public static final int CATCH_GENERIC_EXCEPTION = 396;
9093

9194
/** CWE-397: Declaration of Throws for Generic Exception */
92-
public static int THROW_GENERIC_EXCEPTION = 397;
95+
public static final int THROW_GENERIC_EXCEPTION = 397;
9396

9497
/** CWE-478: Missing Default Case in Switch Statement */
95-
public static int MISSING_DEFAULT_CASE = 478;
98+
public static final int MISSING_DEFAULT_CASE = 478;
9699

97100
/** CWE-483: Incorrect Block Delimitation */
98-
public static int INCORRECT_BLOCK_DELIMITATION = 483;
101+
public static final int INCORRECT_BLOCK_DELIMITATION = 483;
99102

100103
/** CWE-484: Omitted Break Statement in Switch */
101-
public static int OMITTED_BREAK = 484;
104+
public static final int OMITTED_BREAK = 484;
102105

103106
/** CWE-493: Critical Public Variable Without Final Modifier */
104-
public static int PUBLIC_VAR_WITHOUT_FINAL = 493;
107+
public static final int PUBLIC_VAR_WITHOUT_FINAL = 493;
105108

106109
/** CWE-500: Public Static Field Not Marked Final */
107-
public static int PUBLIC_STATIC_NOT_FINAL = 500;
110+
public static final int PUBLIC_STATIC_NOT_FINAL = 500;
108111

109112
/** CWE-501: Trust Boundary Violation */
110-
public static int TRUST_BOUNDARY_VIOLATION = 501;
113+
public static final int TRUST_BOUNDARY_VIOLATION = 501;
111114

112115
/** CWE-502: Deserialization of Untrusted Data */
113-
public static int INSECURE_DESERIALIZATION = 502;
116+
public static final int INSECURE_DESERIALIZATION = 502;
114117

115118
/** CWE-523: Unprotected Transport of Credentials */
116-
public static int UNPROTECTED_CREDENTIALS_TRANSPORT = 523;
119+
public static final int UNPROTECTED_CREDENTIALS_TRANSPORT = 523;
117120

118121
/** CWE-532: Insertion of Sensitive Information into Log File */
119-
public static int SENSITIVE_LOGFILE = 532;
122+
public static final int SENSITIVE_LOGFILE = 532;
120123

121124
/** CWE-564: SQL Injection: Hibernate */
122-
public static int HIBERNATE_INJECTION = 564;
125+
public static final int HIBERNATE_INJECTION = 564;
123126

124127
/** CWE-572: Call to Thread run() instead of start() */
125-
public static int THREAD_WRONG_CALL = 572;
128+
public static final int THREAD_WRONG_CALL = 572;
126129

127130
/** CWE-580: clone() Method Without super.clone() */
128-
public static int CLONE_WITHOUT_SUPER_CLONE = 580;
131+
public static final int CLONE_WITHOUT_SUPER_CLONE = 580;
129132

130133
/** CWE-563: Assignment to Variable without Use */
131-
public static int UNUSED_VAR_ASSIGNMENT = 563;
134+
public static final int UNUSED_VAR_ASSIGNMENT = 563;
132135

133136
/** CWE-581: Object Model Violation: Just One of Equals and Hashcode Defined */
134-
public static int OBJECT_MODEL_VIOLATION = 581;
137+
public static final int OBJECT_MODEL_VIOLATION = 581;
135138

136139
/** CWE-583: finalize() Method Declared Public */
137-
public static int FINALIZE_DECLARED_PUBLIC = 583;
140+
public static final int FINALIZE_DECLARED_PUBLIC = 583;
138141

139142
/** CWE-584: Return Inside Finally Block */
140-
public static int RETURN_INSIDE_FINALLY = 584;
143+
public static final int RETURN_INSIDE_FINALLY = 584;
141144

142145
/** CWE-595: Comparison of Object References Instead of Object Contents */
143-
public static int OBJECT_REFERENCE_COMPARISON = 595;
146+
public static final int OBJECT_REFERENCE_COMPARISON = 595;
144147

145148
/** CWE-601: URL Redirection to Untrusted Site ('Open Redirect') */
146-
public static int OPEN_REDIRECT = 601;
149+
public static final int OPEN_REDIRECT = 601;
147150

148151
/** CWE-611: Improper Restriction of XML External Entity Reference */
149-
public static int XXE = 611;
152+
public static final int XXE = 611;
150153

151154
/** CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute */
152-
public static int INSECURE_COOKIE = 614;
155+
public static final int INSECURE_COOKIE = 614;
153156

154157
/** CWE-643: Improper Neutralization of Data within XPath Expressions ('XPath Injection') */
155-
public static int XPATH_INJECTION = 643;
158+
public static final int XPATH_INJECTION = 643;
156159

157160
/**
158161
* CWE-649: Reliance on Obfuscation or Encryption of Security-Relevant Inputs without Integrity
159162
* Checking
160163
*/
161-
public static int OBFUSCATION = 649;
164+
public static final int OBFUSCATION = 649;
162165

163166
/** CWE-754: Improper Check for Unusual or Exceptional Conditions */
164-
public static int IMPROPER_CHECK_FOR_CONDITIONS = 754;
167+
public static final int IMPROPER_CHECK_FOR_CONDITIONS = 754;
165168

166169
/** CWE-783: Operator Precedence Logic Error */
167-
public static int OPERATOR_PRECEDENCE_LOGIC = 783;
170+
public static final int OPERATOR_PRECEDENCE_LOGIC = 783;
168171

169172
/** CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') */
170-
public static int LOOP_WITH_UNREACHABLE_EXIT = 835;
173+
public static final int LOOP_WITH_UNREACHABLE_EXIT = 835;
171174

172175
/** CWE-916: Use of Password Hash With Insufficient Computational Effort */
173-
public static int PASSWORD_HASH_WITH_INSUFFICIENT_COMPUTATIONAL_EFFORT = 916;
176+
public static final int PASSWORD_HASH_WITH_INSUFFICIENT_COMPUTATIONAL_EFFORT = 916;
174177

175178
/** CWE-918: Server-Side Request Forgery (SSRF) */
176-
public static int SSRF = 918;
179+
public static final int SSRF = 918;
177180

178181
/** CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag */
179-
public static int COOKIE_WITHOUT_HTTPONLY = 1004;
182+
public static final int COOKIE_WITHOUT_HTTPONLY = 1004;
180183

181184
/** CWE-1021: Improper Restriction of Rendered UI Layers or Frames */
182-
public static int IMPROPER_UI_LAYER_RESTRICTION = 1021;
185+
public static final int IMPROPER_UI_LAYER_RESTRICTION = 1021;
183186

184187
/** CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine */
185-
public static int SSTI = 1336;
188+
public static final int SSTI = 1336;
186189
}

plugin/src/main/java/org/owasp/benchmarkutils/score/ResultFile.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ private static CSVParser csvRecords(String content) {
143143
.setHeader()
144144
.setSkipHeaderRecord(false)
145145
.setIgnoreEmptyLines(false)
146-
.build()
146+
.setTrim(true) // trim leading/trailing blanks in column values
147+
.get()
147148
.parse(new StringReader(content));
148149
} catch (IOException e) {
149150
throw new RuntimeException(e);

0 commit comments

Comments
 (0)