Merge pull request #1246 from xiemaisi/js/hardcoded-password

Approved by asger-semmle
This commit is contained in:
semmle-qlci
2019-04-17 08:54:09 +01:00
committed by GitHub
3 changed files with 11 additions and 1 deletions

View File

@@ -45,11 +45,14 @@ from string key, string val, Locatable valElement
where
config(key, val, valElement) and
val != "" and
// exclude possible templates
not val.regexpMatch(Templating::getDelimiterMatchingRegexp()) and
(
key.toLowerCase() = "password"
or
key.toLowerCase() != "readme" and
val.regexpMatch("(?is).*password\\s*=(?!\\s*;).*")
// look for `password=...`, but exclude `password=;` and `password="$(...)"`
val.regexpMatch("(?is).*password\\s*=(?!\\s*;)(?!\"?[$`]).*")
) and
not exclude(valElement.getFile())
select valElement, "Avoid plaintext passwords in configuration files."