Skip to content

Commit 407dcea

Browse files
committed
add String type startsWith
1 parent 1712d01 commit 407dcea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

java/ql/src/experimental/Security/CWE/CWE-348/UseOfLessTrustedSourceLib.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ private class CompareSink extends UseOfLessTrustedSink {
5252
)
5353
or
5454
exists(MethodAccess ma |
55-
ma.getMethod().hasName("contains") and
55+
ma.getMethod().getName() in ["contains", "startsWith"] and
5656
ma.getMethod().getDeclaringType() instanceof TypeString and
5757
ma.getMethod().getNumberOfParameters() = 1 and
5858
ma.getQualifier() = this.asExpr() and
59-
not ma.getArgument(0).(CompileTimeConstantExpr).getStringValue().toLowerCase() in ["", "unknown"]
59+
not ma.getArgument(0).(CompileTimeConstantExpr).getStringValue().toLowerCase() in [
60+
"", "unknown"
61+
]
6062
)
6163
or
6264
exists(MethodAccess ma |

0 commit comments

Comments
 (0)