@@ -20,19 +20,15 @@ module TestConfig implements DataFlow::StateConfigSig {
2020 )
2121 }
2222
23- additional predicate isBarrierGuard ( DataFlow:: BarrierGuardNode node ) {
24- node instanceof IsTypeAGuard or
25- node instanceof IsSanitizedGuard
26- }
27-
2823 predicate isBarrier ( DataFlow:: Node node , DataFlow:: FlowLabel lbl ) {
29- node = DataFlow:: MakeLegacyBarrierGuardLabeled< isBarrierGuard / 1 > :: getABarrierNode ( lbl )
24+ node = DataFlow:: MakeLabeledBarrierGuard< IsTypeAGuard > :: getABarrierNode ( lbl ) or
25+ node = DataFlow:: MakeLabeledBarrierGuard< IsSanitizedGuard > :: getABarrierNode ( lbl )
3026 }
3127}
3228
3329module TestFlow = TaintTracking:: GlobalWithState< TestConfig > ;
3430
35- class LegacyConfig extends TaintTracking:: Configuration {
31+ deprecated class LegacyConfig extends TaintTracking:: Configuration {
3632 LegacyConfig ( ) { this = "LegacyConfig" }
3733
3834 override predicate isSource ( DataFlow:: Node node , DataFlow:: FlowLabel lbl ) {
@@ -44,21 +40,18 @@ class LegacyConfig extends TaintTracking::Configuration {
4440 }
4541
4642 override predicate isSanitizerGuard ( TaintTracking:: SanitizerGuardNode node ) {
47- TestConfig:: isBarrierGuard ( node )
43+ node instanceof IsTypeAGuardLegacy or
44+ node instanceof IsSanitizedGuardLegacy
4845 }
4946}
5047
5148/**
5249 * A condition that checks what kind of value the input is. Not enough to
5350 * sanitize the value, but later sanitizers only need to handle the relevant case.
5451 */
55- class IsTypeAGuard extends TaintTracking :: LabeledSanitizerGuardNode , DataFlow:: CallNode {
52+ class IsTypeAGuard extends DataFlow:: CallNode {
5653 IsTypeAGuard ( ) { this .getCalleeName ( ) = "isTypeA" }
5754
58- override predicate sanitizes ( boolean outcome , Expr e , DataFlow:: FlowLabel lbl ) {
59- this .blocksExpr ( outcome , e , lbl )
60- }
61-
6255 predicate blocksExpr ( boolean outcome , Expr e , DataFlow:: FlowLabel lbl ) {
6356 e = this .getArgument ( 0 ) .asExpr ( ) and
6457 (
@@ -69,12 +62,14 @@ class IsTypeAGuard extends TaintTracking::LabeledSanitizerGuardNode, DataFlow::C
6962 }
7063}
7164
72- class IsSanitizedGuard extends TaintTracking:: LabeledSanitizerGuardNode , DataFlow:: CallNode {
73- IsSanitizedGuard ( ) { this .getCalleeName ( ) = "sanitizeA" or this .getCalleeName ( ) = "sanitizeB" }
74-
65+ deprecated class IsTypeAGuardLegacy extends IsTypeAGuard , TaintTracking:: LabeledSanitizerGuardNode {
7566 override predicate sanitizes ( boolean outcome , Expr e , DataFlow:: FlowLabel lbl ) {
7667 this .blocksExpr ( outcome , e , lbl )
7768 }
69+ }
70+
71+ class IsSanitizedGuard extends DataFlow:: CallNode {
72+ IsSanitizedGuard ( ) { this .getCalleeName ( ) = "sanitizeA" or this .getCalleeName ( ) = "sanitizeB" }
7873
7974 predicate blocksExpr ( boolean outcome , Expr e , DataFlow:: FlowLabel lbl ) {
8075 e = this .getArgument ( 0 ) .asExpr ( ) and
@@ -87,7 +82,15 @@ class IsSanitizedGuard extends TaintTracking::LabeledSanitizerGuardNode, DataFlo
8782 }
8883}
8984
90- import testUtilities.LegacyDataFlowDiff:: DataFlowDiff< TestFlow , LegacyConfig >
85+ deprecated class IsSanitizedGuardLegacy extends IsSanitizedGuard ,
86+ TaintTracking:: LabeledSanitizerGuardNode
87+ {
88+ override predicate sanitizes ( boolean outcome , Expr e , DataFlow:: FlowLabel lbl ) {
89+ this .blocksExpr ( outcome , e , lbl )
90+ }
91+ }
92+
93+ deprecated import testUtilities.LegacyDataFlowDiff:: DataFlowDiff< TestFlow , LegacyConfig >
9194
9295from DataFlow:: Node source , DataFlow:: Node sink
9396where TestFlow:: flow ( source , sink )
0 commit comments