JS: Port HardcodedCredentials

This commit is contained in:
Asger F
2023-10-05 09:18:36 +02:00
parent f4d62c3225
commit 4bac90252c
3 changed files with 151 additions and 375 deletions

View File

@@ -15,14 +15,14 @@
import javascript
import semmle.javascript.security.dataflow.HardcodedCredentialsQuery
import DataFlow::PathGraph
import HardcodedCredentials::PathGraph
bindingset[s]
predicate looksLikeATemplate(string s) { s.regexpMatch(".*((\\{\\{.*\\}\\})|(<.*>)|(\\(.*\\))).*") }
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, string value
from HardcodedCredentials::PathNode source, HardcodedCredentials::PathNode sink, string value
where
cfg.hasFlowPath(source, sink) and
HardcodedCredentials::flowPath(source, sink) and
// use source value in message if it's available
if source.getNode().asExpr() instanceof ConstantString
then