@@ -17,36 +17,26 @@ import java
1717import semmle.code.java.dataflow.FlowSources
1818private import semmle.code.java.dataflow.ExternalFlow
1919import semmle.code.java.security.PathCreation
20+ import semmle.code.java.security.PathSanitizer
2021import DataFlow:: PathGraph
2122import TaintedPathCommon
2223
23- predicate containsDotDotSanitizer ( Guard g , Expr e , boolean branch ) {
24- exists ( MethodAccess contains | g = contains |
25- contains .getMethod ( ) .hasName ( "contains" ) and
26- contains .getAnArgument ( ) .( StringLiteral ) .getValue ( ) = ".." and
27- e = contains .getQualifier ( ) and
28- branch = false
29- )
30- }
31-
3224class TaintedPathConfig extends TaintTracking:: Configuration {
3325 TaintedPathConfig ( ) { this = "TaintedPathConfig" }
3426
3527 override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
3628
3729 override predicate isSink ( DataFlow:: Node sink ) {
38- (
39- sink .asExpr ( ) = any ( PathCreation p ) .getAnInput ( )
40- or
41- sinkNode ( sink , "create-file" )
42- ) and
43- not guarded ( sink .asExpr ( ) )
30+ sink .asExpr ( ) = any ( PathCreation p ) .getAnInput ( )
31+ or
32+ sinkNode ( sink , "create-file" )
4433 }
4534
46- override predicate isSanitizer ( DataFlow:: Node node ) {
47- exists ( Type t | t = node .getType ( ) | t instanceof BoxedType or t instanceof PrimitiveType )
48- or
49- node = DataFlow:: BarrierGuard< containsDotDotSanitizer / 3 > :: getABarrierNode ( )
35+ override predicate isSanitizer ( DataFlow:: Node sanitizer ) {
36+ sanitizer .getType ( ) instanceof BoxedType or
37+ sanitizer .getType ( ) instanceof PrimitiveType or
38+ sanitizer .getType ( ) instanceof NumberType or
39+ sanitizer instanceof PathInjectionSanitizer
5040 }
5141
5242 override predicate isAdditionalTaintStep ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
0 commit comments