@@ -445,35 +445,29 @@ module TaintedPath {
445
445
/**
446
446
* An expression of form `x.includes("..")` or similar.
447
447
*/
448
- class ContainsDotDotSanitizer extends BarrierGuardNode {
449
- StringOps:: Includes contains ;
450
-
448
+ class ContainsDotDotSanitizer extends BarrierGuardNode instanceof StringOps:: Includes {
451
449
ContainsDotDotSanitizer ( ) {
452
- this = contains and
453
- isDotDotSlashPrefix ( contains .getSubstring ( ) )
450
+ isDotDotSlashPrefix ( super .getSubstring ( ) )
454
451
}
455
452
456
453
override predicate blocks ( boolean outcome , Expr e , DataFlow:: FlowLabel label ) {
457
- e = contains .getBaseString ( ) .asExpr ( ) and
458
- outcome = contains .getPolarity ( ) .booleanNot ( ) and
454
+ e = super .getBaseString ( ) .asExpr ( ) and
455
+ outcome = super .getPolarity ( ) .booleanNot ( ) and
459
456
label .( Label:: PosixPath ) .canContainDotDotSlash ( ) // can still be bypassed by normalized absolute path
460
457
}
461
458
}
462
459
463
460
/**
464
461
* An expression of form `x.matches(/\.\./)` or similar.
465
462
*/
466
- class ContainsDotDotRegExpSanitizer extends BarrierGuardNode {
467
- StringOps:: RegExpTest test ;
468
-
463
+ class ContainsDotDotRegExpSanitizer extends BarrierGuardNode instanceof StringOps:: RegExpTest {
469
464
ContainsDotDotRegExpSanitizer ( ) {
470
- this = test and
471
- test .getRegExp ( ) .getConstantValue ( ) = [ "." , ".." , "../" ]
465
+ super .getRegExp ( ) .getConstantValue ( ) = [ "." , ".." , "../" ]
472
466
}
473
467
474
468
override predicate blocks ( boolean outcome , Expr e , DataFlow:: FlowLabel label ) {
475
- e = test .getStringOperand ( ) .asExpr ( ) and
476
- outcome = test .getPolarity ( ) .booleanNot ( ) and
469
+ e = super .getStringOperand ( ) .asExpr ( ) and
470
+ outcome = super .getPolarity ( ) .booleanNot ( ) and
477
471
label .( Label:: PosixPath ) .canContainDotDotSlash ( ) // can still be bypassed by normalized absolute path
478
472
}
479
473
}
0 commit comments