Skip to content

Commit

Permalink
JS: Move VarAccessBarrier outside the deprecated Configuration.qll file
Browse files Browse the repository at this point in the history
  • Loading branch information
asgerf committed Jan 8, 2025
1 parent c47419e commit edc44af
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions javascript/ql/lib/semmle/javascript/dataflow/Nodes.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1708,3 +1708,18 @@ class RegExpCreationNode extends DataFlow::SourceNode {
result = this.getAReference(DataFlow::TypeTracker::end())
}
}

/**
* A guard node for a variable in a negative condition, such as `x` in `if(!x)`.
* Can be added to a `isBarrier` in a data-flow configuration to block flow through such checks.
*/
class VarAccessBarrier extends DataFlow::Node {
VarAccessBarrier() {
exists(ConditionGuardNode guard, SsaRefinementNode refinement |
this = DataFlow::ssaDefinitionNode(refinement) and
refinement.getGuard() = guard and
guard.getTest() instanceof VarAccess and
guard.getOutcome() = false
)
}
}

0 comments on commit edc44af

Please sign in to comment.