mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
21 lines
664 B
Plaintext
21 lines
664 B
Plaintext
import javascript
|
|
|
|
module PasswordConfig implements DataFlow::ConfigSig {
|
|
predicate isSource(DataFlow::Node nd) { nd.asExpr() instanceof StringLiteral }
|
|
|
|
predicate isSink(DataFlow::Node nd) { passwordVarAssign(_, nd) }
|
|
}
|
|
|
|
predicate passwordVarAssign(Variable v, DataFlow::Node nd) {
|
|
v.getAnAssignedExpr() = nd.asExpr() and
|
|
v.getName().toLowerCase() = "password"
|
|
}
|
|
|
|
module PasswordFlow = DataFlow::Global<PasswordConfig>;
|
|
|
|
query predicate test_query17(DataFlow::Node sink, string res) {
|
|
exists(Variable v | PasswordFlow::flowTo(sink) and passwordVarAssign(v, sink) |
|
|
res = "Password variable " + v.toString() + " is assigned a constant string."
|
|
)
|
|
}
|