import javaimport semmle.code.java.dataflow.DataFlowimport semmle.code.java.dataflow.FlowSourcesimport semmle.code.java.dataflow.TaintTrackingclass MyTaintTrackingConfiguration extends TaintTracking::Configuration {MyTaintTrackingConfiguration() {this = "MyTaintTrackingConfiguration"}override predicate isSource(DataFlow::Node source) {exists(source.asParameter())}override predicate isSink(DataFlow::Node sink) {exists(Call call |sink.asExpr() = call.getArgument(0) andcall.getCallee().hasQualifiedName("java.sql", "Statement", "executeQuery"))}}from DataFlow::Node source, DataFlow::Node sink, TaintTracking::Configuration configwhere config.hasFlow(source, sink)select source, sink
优化RemoteFlowSource,增加对RequestParam标注的支持
class MySource extends DataFlow::Node {MySource() {exists(Annotation ann,AnnotationType anntp|this instanceof RemoteFlowSource or (anntp.hasQualifiedName("org.springframework.web.bind.annotation", "RequestParam") andann.getType() = anntp andthis.asParameter().getAnAnnotation() = ann))}}class MyTaintTrackingConfiguration extends TaintTracking::Configuration {MyTaintTrackingConfiguration() {this = "MyTaintTrackingConfiguration"}override predicate isSource(DataFlow::Node source) {source instanceof MySource}override predicate isSink(DataFlow::Node sink) {exists(Call call |sink.asExpr() = call.getArgument(0) andcall.getCallee().hasQualifiedName("java.sql", "Statement", "executeQuery"))}}
