Download src/evaluation/qls_for_security/python/cwe-798_HardcodedCredentials-c.ql from ManavSinghal157/NoFunEval: direct link, hf CLI and curl.
- Browser
- Download file 609 Bytes
-
https://huggingface.co/datasets/ManavSinghal157/NoFunEval/resolve/main/src/evaluation/qls_for_security/python/cwe-798_HardcodedCredentials-c.ql
- Command line
-
hf download hf://datasets/ManavSinghal157/NoFunEval/src/evaluation/qls_for_security/python/cwe-798_HardcodedCredentials-c.ql
-
curl -L -o cwe-798_HardcodedCredentials-c.ql https://huggingface.co/datasets/ManavSinghal157/NoFunEval/resolve/main/src/evaluation/qls_for_security/python/cwe-798_HardcodedCredentials-c.ql
609 Bytes
| /** | |
| * @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() | |