Java: Autoformat most queries.

This commit is contained in:
Anders Schack-Mulligen
2018-10-10 17:49:12 +02:00
parent 85cca69721
commit dd5a8f0c14
443 changed files with 2548 additions and 2043 deletions

View File

@@ -11,6 +11,7 @@
import java
from Method m
where m.getReturnType() instanceof VoidType
and m.fromSource()
where
m.getReturnType() instanceof VoidType and
m.fromSource()
select m

View File

@@ -8,4 +8,3 @@ import semmle.code.xml.MavenPom
from Dependency d
select d, d.getParent*().(Pom), d.getPom()

View File

@@ -2,8 +2,8 @@ import semmle.code.java.security.ControlledString
from Expr controlled, Method method, int line
where
controlledString(controlled)
and method = controlled.getEnclosingCallable()
and line = controlled.getLocation().getStartLine() - method.getLocation().getStartLine()
and controlled.getCompilationUnit().fromSource()
controlledString(controlled) and
method = controlled.getEnclosingCallable() and
line = controlled.getLocation().getStartLine() - method.getLocation().getStartLine() and
controlled.getCompilationUnit().fromSource()
select method.getName(), line, controlled

View File

@@ -2,7 +2,5 @@ import semmle.code.java.security.ControlledString
from Expr precedes, Method method
where endsInQuote(precedes) and precedes.getEnclosingCallable() = method
select
method.getName(),
precedes.getLocation().getStartLine() - method.getLocation().getStartLine(),
precedes
select method.getName(),
precedes.getLocation().getStartLine() - method.getLocation().getStartLine(), precedes

View File

@@ -2,11 +2,6 @@ import semmle.code.java.dataflow.TaintTracking
from StringBuilderVar sbv, MethodAccess append, Method method
where sbv.getAnAppend() = append and append.getEnclosingCallable() = method
select
method.getName(),
sbv.getLocation().getStartLine() - method.getLocation().getStartLine(),
sbv,
append.getLocation().getStartLine() - method.getLocation().getStartLine(),
append,
select method.getName(), sbv.getLocation().getStartLine() - method.getLocation().getStartLine(),
sbv, append.getLocation().getStartLine() - method.getLocation().getStartLine(), append,
append.getArgument(0)

View File

@@ -2,9 +2,5 @@ import semmle.code.java.dataflow.TaintTracking
from StringBuilderVar sbv, MethodAccess toString, Method method
where sbv.getToStringCall() = toString and toString.getEnclosingCallable() = method
select
method.getName(),
sbv.getLocation().getStartLine() - method.getLocation().getStartLine(),
sbv,
toString.getLocation().getStartLine() - method.getLocation().getStartLine(),
toString
select method.getName(), sbv.getLocation().getStartLine() - method.getLocation().getStartLine(),
sbv, toString.getLocation().getStartLine() - method.getLocation().getStartLine(), toString

View File

@@ -2,13 +2,8 @@ import semmle.code.java.security.SqlUnescapedLib
from StringBuilderVar sbv, Expr uncontrolled, Method method, int methodLine
where
uncontrolledStringBuilderQuery(sbv, uncontrolled)
and method = uncontrolled.getEnclosingCallable()
and methodLine = method.getLocation().getStartLine()
select
method.getName(),
sbv.getLocation().getStartLine() - methodLine,
sbv,
uncontrolled.getLocation().getStartLine() - methodLine,
uncontrolled
uncontrolledStringBuilderQuery(sbv, uncontrolled) and
method = uncontrolled.getEnclosingCallable() and
methodLine = method.getLocation().getStartLine()
select method.getName(), sbv.getLocation().getStartLine() - methodLine, sbv,
uncontrolled.getLocation().getStartLine() - methodLine, uncontrolled

View File

@@ -2,13 +2,12 @@ import semmle.code.java.dataflow.FlowSources
class Conf extends TaintTracking::Configuration {
Conf() { this = "qltest:cwe-089:taintedString" }
override predicate isSource(DataFlow::Node source) { source instanceof UserInput }
override predicate isSink(DataFlow::Node sink) { any() }
}
from Conf conf, Expr tainted, Method method
where conf.hasFlowToExpr(tainted) and tainted.getEnclosingCallable() = method
select
method,
tainted.getLocation().getStartLine() - method.getLocation().getStartLine(),
tainted
select method, tainted.getLocation().getStartLine() - method.getLocation().getStartLine(), tainted