JS: Add consistency test

This commit is contained in:
Asger Feldthaus
2022-02-16 09:32:59 +01:00
parent 3103cfd925
commit cf66d01e80
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
consistencyIssue
resultInWrongFile

View File

@@ -0,0 +1,17 @@
import javascript
import semmle.javascript.security.dataflow.RequestForgeryQuery as RequestForgery
import semmle.javascript.security.dataflow.ClientSideRequestForgeryQuery as ClientSideRequestForgery
import testUtilities.ConsistencyChecking
query predicate resultInWrongFile(DataFlow::Node node) {
exists(DataFlow::Configuration cfg, string filePattern |
cfg instanceof RequestForgery::Configuration and
filePattern = ".*serverSide.*"
or
cfg instanceof ClientSideRequestForgery::Configuration and
filePattern = ".*clientSide.*"
|
cfg.hasFlow(_, node) and
not node.getFile().getRelativePath().regexpMatch(filePattern)
)
}