Skip to content

Commit a6cae2b

Browse files
authored
Merge pull request #1723 from xiemaisi/js/overlapping-barriers
Approved by asger-semmle
2 parents b348803 + d2f4575 commit a6cae2b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,13 @@ module FlowLabel {
280280
/**
281281
* A node that can act as a barrier when appearing in a condition.
282282
*
283-
* To use this barrier in `Configuration` `cfg`, add this barrier to the
284-
* extent of `cfg.isBarrierGuard`.
283+
* To add a barrier guard to a configuration, define a subclass of this class overriding the
284+
* `blocks` predicate, and then extend the configuration's `isBarrierGuard` predicate to include
285+
* the new class.
286+
*
287+
* Note that it is generally a good idea to make the characteristic predicate of barrier guard
288+
* classes as precise as possible: if two subclasses of `BarrierGuardNode` overlap, their
289+
* implementations of `blocks` will _both_ apply to any configuration that includes either of them.
285290
*/
286291
abstract class BarrierGuardNode extends DataFlow::Node {
287292
/**

javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ module TaintTracking {
143143

144144
/**
145145
* A node that can act as a sanitizer when appearing in a condition.
146+
*
147+
* To add a sanitizer guard to a configuration, define a subclass of this class overriding the
148+
* `sanitizes` predicate, and then extend the configuration's `isSanitizerGuard` predicate to
149+
* include the new class.
150+
*
151+
* Note that it is generally a good idea to make the characteristic predicate of sanitizer guard
152+
* classes as precise as possible: if two subclasses of `SanitizerGuardNode` overlap, their
153+
* implementations of `sanitizes` will _both_ apply to any configuration that includes either of
154+
* them.
146155
*/
147156
abstract class SanitizerGuardNode extends DataFlow::BarrierGuardNode {
148157
override predicate blocks(boolean outcome, Expr e) { sanitizes(outcome, e) }

0 commit comments

Comments
 (0)