Java: Adjust a few qltests.

This commit is contained in:
Anders Schack-Mulligen
2020-09-01 12:49:09 +02:00
parent c25dd4be8c
commit e5d7208c12
3 changed files with 10 additions and 3 deletions

View File

@@ -5,5 +5,6 @@ where
controlledString(controlled) and
method = controlled.getEnclosingCallable() and
line = controlled.getLocation().getStartLine() - method.getLocation().getStartLine() and
controlled.getCompilationUnit().fromSource()
controlled.getCompilationUnit().fromSource() and
controlled.getFile().getStem() = ["Test", "Validation"]
select method.getName(), line, controlled

View File

@@ -1,6 +1,9 @@
import semmle.code.java.security.ControlledString
from Expr precedes, Method method
where endsInQuote(precedes) and precedes.getEnclosingCallable() = method
where
endsInQuote(precedes) and
precedes.getEnclosingCallable() = method and
precedes.getFile().getStem() = "Test"
select method.getName(),
precedes.getLocation().getStartLine() - method.getLocation().getStartLine(), precedes

View File

@@ -9,5 +9,8 @@ class Conf extends TaintTracking::Configuration {
}
from Conf conf, Expr tainted, Method method
where conf.hasFlowToExpr(tainted) and tainted.getEnclosingCallable() = method
where
conf.hasFlowToExpr(tainted) and
tainted.getEnclosingCallable() = method and
tainted.getFile().getStem() = ["Test", "Validation"]
select method, tainted.getLocation().getStartLine() - method.getLocation().getStartLine(), tainted