@@ -173,6 +173,33 @@ abstract class NonLocalJumpNode extends Node {
173
173
}
174
174
175
175
/**
176
+ * Holds if the guard `g` validates the expression `e` upon evaluating to `v`.
177
+ *
178
+ * The expression `e` is expected to be a syntactic part of the guard `g`.
179
+ * For example, the guard `g` might be a call `isSafe(x)` and the expression `e`
180
+ * the argument `x`.
181
+ */
182
+ signature predicate guardChecksSig ( Guard g , Expr e , AbstractValue v ) ;
183
+
184
+ /**
185
+ * Provides a set of barrier nodes for a guard that validates an expression.
186
+ *
187
+ * This is expected to be used in `isBarrier`/`isSanitizer` definitions
188
+ * in data flow and taint tracking.
189
+ */
190
+ module BarrierGuard< guardChecksSig / 3 guardChecks> {
191
+ /** Gets a node that is safely guarded by the given guard check. */
192
+ ExprNode getABarrierNode ( ) {
193
+ exists ( Guard g , Expr e , AbstractValue v |
194
+ guardChecks ( g , e , v ) and
195
+ g .controlsNode ( result .getControlFlowNode ( ) , e , v )
196
+ )
197
+ }
198
+ }
199
+
200
+ /**
201
+ * DEPRECATED: Use `BarrierGuard` module instead.
202
+ *
176
203
* A guard that validates some expression.
177
204
*
178
205
* To use this in a configuration, extend the class and provide a
@@ -181,7 +208,7 @@ abstract class NonLocalJumpNode extends Node {
181
208
*
182
209
* It is important that all extending classes in scope are disjoint.
183
210
*/
184
- class BarrierGuard extends Guard {
211
+ deprecated class BarrierGuard extends Guard {
185
212
/** Holds if this guard validates `e` upon evaluating to `v`. */
186
213
abstract predicate checks ( Expr e , AbstractValue v ) ;
187
214
0 commit comments