Skip to content

Commit 0166990

Browse files
committed
JS: Block InsecureRandomness flow into test files
1 parent 80a5a59 commit 0166990

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/InsecureRandomnessQuery.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import javascript
1111
private import semmle.javascript.security.SensitiveActions
1212
import InsecureRandomnessCustomizations::InsecureRandomness
1313
private import InsecureRandomnessCustomizations::InsecureRandomness as InsecureRandomness
14+
private import semmle.javascript.filters.ClassifyFiles as ClassifyFiles
1415

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

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

23-
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
24+
predicate isBarrier(DataFlow::Node node) {
25+
node instanceof Sanitizer
26+
or
27+
ClassifyFiles::isTestFile(node.getFile())
28+
}
2429

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

0 commit comments

Comments
 (0)