@@ -67,6 +67,313 @@ docker_best_practices_data:
67
67
- link : " /continuous_integration/static_analysis/rules/docker-best-practices/zypper-use-y"
68
68
tag : " zypper-use-y"
69
69
text : " Always use -y with zypper install"
70
+ java_best_practices_data :
71
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/add-empty-string"
72
+ tag : " add-empty-string"
73
+ text : " Do not add an empty string"
74
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/array-is-stored-directly"
75
+ tag : " array-is-stored-directly"
76
+ text : " Should clone array"
77
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/arrays-aslist"
78
+ tag : " arrays-aslist"
79
+ text : " Use asList to create a list from array"
80
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-calendar-creation"
81
+ tag : " avoid-calendar-creation"
82
+ text : " Avoid Date() instantiation"
83
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-filestream"
84
+ tag : " avoid-filestream"
85
+ text : " Avoid creating FileStream directly"
86
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-message-digest-field"
87
+ tag : " avoid-message-digest-field"
88
+ text : " Avoid declaring a field type as MessageDigest"
89
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-printstacktrace"
90
+ tag : " avoid-printstacktrace"
91
+ text : " Avoid using printStackTrace()"
92
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-reassigning-catch-vars"
93
+ tag : " avoid-reassigning-catch-vars"
94
+ text : " Don't reassign a catch variable"
95
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-reassigning-parameters"
96
+ tag : " avoid-reassigning-parameters"
97
+ text : " Avoid reassigning parameters"
98
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/avoid-string-instantiation"
99
+ tag : " avoid-string-instantiation"
100
+ text : " Avoid instantiating strings "
101
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/constants-in-interfaces"
102
+ tag : " constants-in-interfaces"
103
+ text : " Using constants in an interface"
104
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/default-label-not-last-in-switch"
105
+ tag : " default-label-not-last-in-switch"
106
+ text : " Default label should be last in a switch"
107
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/forloop-variable-count"
108
+ tag : " forloop-variable-count"
109
+ text : " Too many control variables in for loop"
110
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/indexof-char"
111
+ tag : " indexof-char"
112
+ text : " Do not use a string with only one character"
113
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/literals-first-in-comparison"
114
+ tag : " literals-first-in-comparison"
115
+ text : " The literals should be first in String comparisons"
116
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/loose-coupling"
117
+ tag : " loose-coupling"
118
+ text : " Avoid using specific implementation types"
119
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/missing-switch-statement-default"
120
+ tag : " missing-switch-statement-default"
121
+ text : " Switch statements should have a default case"
122
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/one-declaration-per-line"
123
+ tag : " one-declaration-per-line"
124
+ text : " Separate lines for each field declaration"
125
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/preserve-stack-trace"
126
+ tag : " preserve-stack-trace"
127
+ text : " Preserve the thrown stack trace"
128
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/redundant-initializer"
129
+ tag : " redundant-initializer"
130
+ text : " Avoid redundant initialization"
131
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/replace-hashtable-with-map"
132
+ tag : " replace-hashtable-with-map"
133
+ text : " Should use Map instead of Hashtable"
134
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/replace-vector-with-list"
135
+ tag : " replace-vector-with-list"
136
+ text : " Replace Vector with List"
137
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/return-internal-array"
138
+ tag : " return-internal-array"
139
+ text : " Do not return internal array"
140
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/sb-append-char"
141
+ tag : " sb-append-char"
142
+ text : " Do not append char as strings"
143
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/simplify-test-assertions-boolean"
144
+ tag : " simplify-test-assertions-boolean"
145
+ text : " Test assertions for booleans can be simplified"
146
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/simplify-test-assertions-equals"
147
+ tag : " simplify-test-assertions-equals"
148
+ text : " Test assertions using equals comparison can be simplified"
149
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/simplify-test-assertions-null"
150
+ tag : " simplify-test-assertions-null"
151
+ text : " Test assertions using null comparison can be simplified"
152
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/simplify-test-assertions-ops"
153
+ tag : " simplify-test-assertions-ops"
154
+ text : " Test assertions using operator comparison can be simplified"
155
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/string-buffer-field"
156
+ tag : " string-buffer-field"
157
+ text : " Do not use StringBuffer or StringBuilder as a class field"
158
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/switch-few-branches"
159
+ tag : " switch-few-branches"
160
+ text : " Avoid switch with very few branches"
161
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/use-stringbuffer"
162
+ tag : " use-stringbuffer"
163
+ text : " Use StringBuffer to concatenate strings"
164
+ - link : " /continuous_integration/static_analysis/rules/java-best-practices/while-loop-with-literal-boolean"
165
+ tag : " while-loop-with-literal-boolean"
166
+ text : " Loops can be simplified or removed"
167
+ java_code_style_data :
168
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/avoid-dollar-signs"
169
+ tag : " avoid-dollar-signs"
170
+ text : " Avoid using dollar signs in variable names"
171
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/avoid-protected-in-final-class"
172
+ tag : " avoid-protected-in-final-class"
173
+ text : " Avoid using protected field in final class"
174
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/avoid-using-native-code"
175
+ tag : " avoid-using-native-code"
176
+ text : " Avoid using Java native code"
177
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/boolean-get-method-name"
178
+ tag : " boolean-get-method-name"
179
+ text : " Avoid prefix boolean returning method with `get`"
180
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/call-super-in-constructor"
181
+ tag : " call-super-in-constructor"
182
+ text : " Consider calling super in constructor"
183
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/class-naming-conventions"
184
+ tag : " class-naming-conventions"
185
+ text : " Enforce a naming convention for any type of class"
186
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/confusing-ternary"
187
+ tag : " confusing-ternary"
188
+ text : " Avoid negation in your ternary operation"
189
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/control-statement-braces"
190
+ tag : " control-statement-braces"
191
+ text : " Enforce using control statement brackets"
192
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/extends-object"
193
+ tag : " extends-object"
194
+ text : " Avoid unnecessary object extend"
195
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/final-param-in-abstract-method"
196
+ tag : " final-param-in-abstract-method"
197
+ text : " Avoid useless final type in interface method"
198
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/for-loop-should-be-while-loop"
199
+ tag : " for-loop-should-be-while-loop"
200
+ text : " Simplify for loops for while loops"
201
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/generics-naming"
202
+ tag : " generics-naming"
203
+ text : " Enforce generic naming standards"
204
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/local-home-naming-convention"
205
+ tag : " local-home-naming-convention"
206
+ text : " Enforce using the LocalHome suffix for Session EJB"
207
+ - link : " /continuous_integration/static_analysis/rules/java-code-style/package-case"
208
+ tag : " package-case"
209
+ text : " Package names should not contain uppercase characters"
210
+ java_inclusive_data :
211
+ - link : " /continuous_integration/static_analysis/rules/java-inclusive/class-definition"
212
+ tag : " class-definition"
213
+ text : " Check class definition language"
214
+ - link : " /continuous_integration/static_analysis/rules/java-inclusive/function-definition"
215
+ tag : " function-definition"
216
+ text : " Check function definition language"
217
+ - link : " /continuous_integration/static_analysis/rules/java-inclusive/variable-assignment"
218
+ tag : " variable-assignment"
219
+ text : " Check variable assignment language"
220
+ java_security_data :
221
+ - link : " /continuous_integration/static_analysis/rules/java-security/aes-ecb-insecure"
222
+ tag : " aes-ecb-insecure"
223
+ text : " ECB mode is insecure"
224
+ - link : " /continuous_integration/static_analysis/rules/java-security/algorithm-no-hardcoded-secret"
225
+ tag : " algorithm-no-hardcoded-secret"
226
+ text : " No hardcoded secret with algorithm methods"
227
+ - link : " /continuous_integration/static_analysis/rules/java-security/avoid-null-cipher"
228
+ tag : " avoid-null-cipher"
229
+ text : " Avoid NullCipher"
230
+ - link : " /continuous_integration/static_analysis/rules/java-security/avoid-random"
231
+ tag : " avoid-random"
232
+ text : " Prefer SecureRandom over Random"
233
+ - link : " /continuous_integration/static_analysis/rules/java-security/bad-hexa-concatenation"
234
+ tag : " bad-hexa-concatenation"
235
+ text : " Bad hexadecimal concatenation"
236
+ - link : " /continuous_integration/static_analysis/rules/java-security/blowfish-short-key"
237
+ tag : " blowfish-short-key"
238
+ text : " Blowfish should use a large key"
239
+ - link : " /continuous_integration/static_analysis/rules/java-security/cipher-padding-oracle"
240
+ tag : " cipher-padding-oracle"
241
+ text : " ECB mode is insecure"
242
+ - link : " /continuous_integration/static_analysis/rules/java-security/cookies-http-only"
243
+ tag : " cookies-http-only"
244
+ text : " Cookies HTTP only"
245
+ - link : " /continuous_integration/static_analysis/rules/java-security/cookies-persistence"
246
+ tag : " cookies-persistence"
247
+ text : " Cookies should not have a long expiration"
248
+ - link : " /continuous_integration/static_analysis/rules/java-security/cookies-secure-flag"
249
+ tag : " cookies-secure-flag"
250
+ text : " Ensure cookies have the secure flag"
251
+ - link : " /continuous_integration/static_analysis/rules/java-security/default-http-client-def-cons"
252
+ tag : " default-http-client-def-cons"
253
+ text : " DefaultHttpClient with default constructor is not secure"
254
+ - link : " /continuous_integration/static_analysis/rules/java-security/files-permissions"
255
+ tag : " files-permissions"
256
+ text : " Do not give write access to others"
257
+ - link : " /continuous_integration/static_analysis/rules/java-security/groovyshell-code-injection"
258
+ tag : " groovyshell-code-injection"
259
+ text : " Potential code injection when using GroovyShell"
260
+ - link : " /continuous_integration/static_analysis/rules/java-security/hardcoded-crypto-key"
261
+ tag : " hardcoded-crypto-key"
262
+ text : " Secret should not be hardcoded in code"
263
+ - link : " /continuous_integration/static_analysis/rules/java-security/hostname-verifier-true"
264
+ tag : " hostname-verifier-true"
265
+ text : " HostnameVerifier should check certificates"
266
+ - link : " /continuous_integration/static_analysis/rules/java-security/http-parameter-pollution"
267
+ tag : " http-parameter-pollution"
268
+ text : " Prevent HTTP parameter pollution"
269
+ - link : " /continuous_integration/static_analysis/rules/java-security/ignore-saml-comment"
270
+ tag : " ignore-saml-comment"
271
+ text : " Ignore SAML comments"
272
+ - link : " /continuous_integration/static_analysis/rules/java-security/json-unsafe-deserialization"
273
+ tag : " json-unsafe-deserialization"
274
+ text : " Avoid unsafe deserialization"
275
+ - link : " /continuous_integration/static_analysis/rules/java-security/keygenerator-avoid-des"
276
+ tag : " keygenerator-avoid-des"
277
+ text : " Avoid DES keys"
278
+ - link : " /continuous_integration/static_analysis/rules/java-security/ldap-entry-poisoning"
279
+ tag : " ldap-entry-poisoning"
280
+ text : " Prevent LDAP Entry Poisoning"
281
+ - link : " /continuous_integration/static_analysis/rules/java-security/ldap-injection"
282
+ tag : " ldap-injection"
283
+ text : " Avoid LDAP injections"
284
+ - link : " /continuous_integration/static_analysis/rules/java-security/message-digest-custom"
285
+ tag : " message-digest-custom"
286
+ text : " Do not use custom digest"
287
+ - link : " /continuous_integration/static_analysis/rules/java-security/no-des-cipher"
288
+ tag : " no-des-cipher"
289
+ text : " Do not use DES"
290
+ - link : " /continuous_integration/static_analysis/rules/java-security/no-pseudo-random-secret"
291
+ tag : " no-pseudo-random-secret"
292
+ text : " Do not use a pseudo-random number to generate a secret"
293
+ - link : " /continuous_integration/static_analysis/rules/java-security/no-rsa-no-padding"
294
+ tag : " no-rsa-no-padding"
295
+ text : " RSA with no padding is insecure"
296
+ - link : " /continuous_integration/static_analysis/rules/java-security/object-deserialization"
297
+ tag : " object-deserialization"
298
+ text : " Prevent deserialization"
299
+ - link : " /continuous_integration/static_analysis/rules/java-security/path-traversal-file-read"
300
+ tag : " path-traversal-file-read"
301
+ text : " Potential path traversal from request"
302
+ - link : " /continuous_integration/static_analysis/rules/java-security/permissive-cors"
303
+ tag : " permissive-cors"
304
+ text : " Avoid overly permissive CORS"
305
+ - link : " /continuous_integration/static_analysis/rules/java-security/potential-sql-injection"
306
+ tag : " potential-sql-injection"
307
+ text : " SQL injection in SqlUtil.execQuery"
308
+ - link : " /continuous_integration/static_analysis/rules/java-security/processbuilder-injection"
309
+ tag : " processbuilder-injection"
310
+ text : " Avoid command injection with ProcessBuilder"
311
+ - link : " /continuous_integration/static_analysis/rules/java-security/random-iv"
312
+ tag : " random-iv"
313
+ text : " Use a randomly-generated IV"
314
+ - link : " /continuous_integration/static_analysis/rules/java-security/response-direct-writer"
315
+ tag : " response-direct-writer"
316
+ text : " Prevent direct writing on the response"
317
+ - link : " /continuous_integration/static_analysis/rules/java-security/rsa-short-key"
318
+ tag : " rsa-short-key"
319
+ text : " RSA should use a long key"
320
+ - link : " /continuous_integration/static_analysis/rules/java-security/smtp-insecure-connection"
321
+ tag : " smtp-insecure-connection"
322
+ text : " SMTP server identify must be enforced"
323
+ - link : " /continuous_integration/static_analysis/rules/java-security/spring-csrf-disable"
324
+ tag : " spring-csrf-disable"
325
+ text : " Do not disable CSRF"
326
+ - link : " /continuous_integration/static_analysis/rules/java-security/spring-csrf-requestmapping"
327
+ tag : " spring-csrf-requestmapping"
328
+ text : " Spring CSRF unrestricted RequestMapping"
329
+ - link : " /continuous_integration/static_analysis/rules/java-security/spring-expression-injection"
330
+ tag : " spring-expression-injection"
331
+ text : " Potential code injection when using Spring Expression"
332
+ - link : " /continuous_integration/static_analysis/rules/java-security/spring-request-file-tainted"
333
+ tag : " spring-request-file-tainted"
334
+ text : " Avoid user-input file"
335
+ - link : " /continuous_integration/static_analysis/rules/java-security/sql-injection-hibernate"
336
+ tag : " sql-injection-hibernate"
337
+ text : " SQL injection in Hibernate"
338
+ - link : " /continuous_integration/static_analysis/rules/java-security/sql-injection-turbine"
339
+ tag : " sql-injection-turbine"
340
+ text : " SQL injection in BasePeer"
341
+ - link : " /continuous_integration/static_analysis/rules/java-security/sql-string-tainted"
342
+ tag : " sql-string-tainted"
343
+ text : " Avoid manual SQL queries"
344
+ - link : " /continuous_integration/static_analysis/rules/java-security/ssl-context"
345
+ tag : " ssl-context"
346
+ text : " Do not use weak SSL context"
347
+ - link : " /continuous_integration/static_analysis/rules/java-security/unencrypted-socket"
348
+ tag : " unencrypted-socket"
349
+ text : " Use of socket on HTTP port"
350
+ - link : " /continuous_integration/static_analysis/rules/java-security/unsafe-reflection"
351
+ tag : " unsafe-reflection"
352
+ text : " Avoid user-generated class names for reflection"
353
+ - link : " /continuous_integration/static_analysis/rules/java-security/unvalidated-redirect"
354
+ tag : " unvalidated-redirect"
355
+ text : " Do not use unvalidated request"
356
+ - link : " /continuous_integration/static_analysis/rules/java-security/weak-message-digest-md5"
357
+ tag : " weak-message-digest-md5"
358
+ text : " MD2, MD4, and MD5 are weak hash functions"
359
+ - link : " /continuous_integration/static_analysis/rules/java-security/weak-message-digest-sha1"
360
+ tag : " weak-message-digest-sha1"
361
+ text : " SHA-1 is a weak hash function"
362
+ - link : " /continuous_integration/static_analysis/rules/java-security/xml-parsing-xee"
363
+ tag : " xml-parsing-xee"
364
+ text : " XML parsing vulnerable to XEE"
365
+ - link : " /continuous_integration/static_analysis/rules/java-security/xml-parsing-xxe-saxparser"
366
+ tag : " xml-parsing-xxe-saxparser"
367
+ text : " XML parsing vulnerable to XXE for SAX Parsers"
368
+ - link : " /continuous_integration/static_analysis/rules/java-security/xml-parsing-xxe-transformer"
369
+ tag : " xml-parsing-xxe-transformer"
370
+ text : " XML parsing vulnerable to XXE for TransformerFactory"
371
+ - link : " /continuous_integration/static_analysis/rules/java-security/xml-parsing-xxe-xmlreader"
372
+ tag : " xml-parsing-xxe-xmlreader"
373
+ text : " XML parsing vulnerable to XXE for XML Reader"
374
+ - link : " /continuous_integration/static_analysis/rules/java-security/xml-parsing-xxe-xpath"
375
+ tag : " xml-parsing-xxe-xpath"
376
+ text : " XML parsing vulnerable to XXE for XPath"
70
377
javascript_best_practices_data :
71
378
- link : " /continuous_integration/static_analysis/rules/javascript-best-practices/for-direction"
72
379
tag : " for-direction"
@@ -1256,6 +1563,48 @@ Best practices for using Docker.
1256
1563
1257
1564
<br >
1258
1565
1566
+ ## Java rules
1567
+
1568
+ ### Follow best practices in Java
1569
+
1570
+ ** Ruleset ID:** ` java-best-practices `
1571
+
1572
+ Rules to enforce Java best practices.
1573
+
1574
+ {{< sa-rule-list "java_best_practices_data" >}}
1575
+
1576
+ <br >
1577
+
1578
+ ### Follow Java code style patterns
1579
+
1580
+ ** Ruleset ID:** ` java-code-style `
1581
+
1582
+ Rules to enforce Java code style.
1583
+
1584
+ {{< sa-rule-list "java_code_style_data" >}}
1585
+
1586
+ <br >
1587
+
1588
+ ### Use inclusive language in Java
1589
+
1590
+ ** Ruleset ID:** ` java-inclusive `
1591
+
1592
+ Rules for Java to avoid inappropriate wording in the code and comments.
1593
+
1594
+ {{< sa-rule-list "java_inclusive_data" >}}
1595
+
1596
+ <br >
1597
+
1598
+ ### Ensure your Java code is secure
1599
+
1600
+ ** Ruleset ID:** ` java-security `
1601
+
1602
+ Rules focused on finding security issues in Java code.
1603
+
1604
+ {{< sa-rule-list "java_security_data" >}}
1605
+
1606
+ <br >
1607
+
1259
1608
## JavaScript rules
1260
1609
1261
1610
### Follow best practices for writing JavaScript code
0 commit comments