Skip to content

Commit

Permalink
JS: Block InsecureRandomness flow into test files
Browse files Browse the repository at this point in the history
  • Loading branch information
asgerf committed Nov 19, 2024
1 parent 80a5a59 commit 0166990
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import javascript
private import semmle.javascript.security.SensitiveActions
import InsecureRandomnessCustomizations::InsecureRandomness
private import InsecureRandomnessCustomizations::InsecureRandomness as InsecureRandomness
private import semmle.javascript.filters.ClassifyFiles as ClassifyFiles

/**
* A taint tracking configuration for random values that are not cryptographically secure.
Expand All @@ -20,7 +21,11 @@ module InsecureRandomnessConfig implements DataFlow::ConfigSig {

predicate isSink(DataFlow::Node sink) { sink instanceof Sink }

predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
predicate isBarrier(DataFlow::Node node) {
node instanceof Sanitizer
or
ClassifyFiles::isTestFile(node.getFile())
}

predicate isBarrierOut(DataFlow::Node node) {
// stop propagation at the sinks to avoid double reporting
Expand Down

0 comments on commit 0166990

Please sign in to comment.