File size: 609 Bytes
3f53269 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /**
* @name Check for CWE-798 in codeql-eg-HardcodedCredentials-c
* @description
* @kind problem
* @problem.severity warning
* @id custom-cpp/cwe-798_codeql-eg-HardcodedCredentials-c
*/
import python
string getACredentialRegex() {
result = "(?i).*pass(wd|word|code|phrase)(?!.*question).*" or
result = "(?i).*(puid|username|userid|user).*" or
result = "(?i).*(cert)(?!.*(format|name)).*"
}
from Keyword k, Expr literal
where
k.getArg().toString().regexpMatch(getACredentialRegex())
and
literal instanceof StrConst
and
k.getValue()=literal
select k, k.getArg().toString()
|