Skip to content

Commit 24f9f13

Browse files
committed
Python: Fix tests
1 parent 0443057 commit 24f9f13

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

python/ql/src/experimental/Security/CWE-287-ConstantSecretKey/WebAppConstantSecretKey.ql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ module WebAppConstantSecretKeyConfig implements DataFlow::StateConfigSig {
3535
}
3636

3737
predicate isBarrier(DataFlow::Node node) {
38-
node.getLocation().getFile().inStdlib() or
38+
node.getLocation().getFile().inStdlib()
39+
or
40+
// To reduce FP rate, the following was added
3941
node.getLocation()
4042
.getFile()
41-
.getAbsolutePath()
42-
.matches(["%test%", "%demo%", "%example%", "%sample%"])
43+
.getRelativePath()
44+
.matches(["%test%", "%demo%", "%example%", "%sample%"]) and
45+
// but that also meant all data-flow nodes in query tests were excluded... so we had
46+
// to add this:
47+
not node.getLocation().getFile().getRelativePath().matches("%query-tests/Security/CWE-287%")
4348
}
4449

4550
predicate isSink(DataFlow::Node sink, FlowState state) {

0 commit comments

Comments
 (0)