File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
java/ql/lib/semmle/code/java/security Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,23 @@ private string nonSuspicious() {
2828}
2929
3030/**
31- * Gets a regular expression for matching common names of variables that indicate the value being held contains sensitive information.
31+ * Gets a regular expression for matching common names of variables that
32+ * indicate the value being held contains sensitive information.
3233 */
3334string getCommonSensitiveInfoRegex ( ) {
3435 result = "(?i).*(challenge|pass(wd|word|code|phrase))(?!.*question).*" or
3536 result = "(?i).*(token|secret).*"
3637}
3738
39+ /**
40+ * Gets a regular expression for matching common names of variables that
41+ * indicate the value being held does not contains sensitive information,
42+ * but is a false positive for `getCommonSensitiveInfoRegex`.
43+ *
44+ * - "tokenImage" appears in parser code generated by JavaCC.
45+ */
46+ string getCommonSensitiveInfoFPRegex ( ) { result = "(?i).*(null).*" or result = "tokenImage" }
47+
3848/** An expression that might contain sensitive data. */
3949abstract class SensitiveExpr extends Expr { }
4050
Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ class VariableWithSensitiveName extends Variable {
1515 VariableWithSensitiveName ( ) {
1616 exists ( string name | name = this .getName ( ) |
1717 name .regexpMatch ( getCommonSensitiveInfoRegex ( ) ) and
18- not name .regexpMatch ( "(?i).*null.*" ) and
19- name != "tokenImage" // appears in parser code generated by JavaCC
18+ not name .regexpMatch ( getCommonSensitiveInfoFPRegex ( ) )
2019 )
2120 }
2221}
You can’t perform that action at this time.
0 commit comments