Skip to content

Commit e5d7208

Browse files
committed
Java: Adjust a few qltests.
1 parent c25dd4b commit e5d7208

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

java/ql/test/query-tests/security/CWE-089/semmle/examples/controlledString.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ where
55
controlledString(controlled) and
66
method = controlled.getEnclosingCallable() and
77
line = controlled.getLocation().getStartLine() - method.getLocation().getStartLine() and
8-
controlled.getCompilationUnit().fromSource()
8+
controlled.getCompilationUnit().fromSource() and
9+
controlled.getFile().getStem() = ["Test", "Validation"]
910
select method.getName(), line, controlled
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import semmle.code.java.security.ControlledString
22

33
from Expr precedes, Method method
4-
where endsInQuote(precedes) and precedes.getEnclosingCallable() = method
4+
where
5+
endsInQuote(precedes) and
6+
precedes.getEnclosingCallable() = method and
7+
precedes.getFile().getStem() = "Test"
58
select method.getName(),
69
precedes.getLocation().getStartLine() - method.getLocation().getStartLine(), precedes

java/ql/test/query-tests/security/CWE-089/semmle/examples/taintedString.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ class Conf extends TaintTracking::Configuration {
99
}
1010

1111
from Conf conf, Expr tainted, Method method
12-
where conf.hasFlowToExpr(tainted) and tainted.getEnclosingCallable() = method
12+
where
13+
conf.hasFlowToExpr(tainted) and
14+
tainted.getEnclosingCallable() = method and
15+
tainted.getFile().getStem() = ["Test", "Validation"]
1316
select method, tainted.getLocation().getStartLine() - method.getLocation().getStartLine(), tainted

0 commit comments

Comments
 (0)