Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 46c4670

Browse files
author
Max Schaefer
committed
Make HardcodedCredentials query less noisy.
Considering "cert" and "account" to be sensitive leads to a massive number of false positives, especially on cockroach and kubernetes.
1 parent eb639c6 commit 46c4670

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

ql/src/semmle/go/security/SensitiveActions.qll

-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ module HeuristicNames {
2828
* user names or other account information.
2929
*/
3030
string maybeAccountInfo() {
31-
result = "(?is).*acc(ou)?nt.*" or
3231
result = "(?is).*(puid|username|userid).*"
3332
}
3433

@@ -41,12 +40,6 @@ module HeuristicNames {
4140
result = "(?is).*(auth(entication|ori[sz]ation)?)key.*"
4241
}
4342

44-
/**
45-
* Gets a regular expression that identifies strings that may indicate the presence of
46-
* a certificate.
47-
*/
48-
string maybeCertificate() { result = "(?is).*(cert)(?!.*(format|name)).*" }
49-
5043
/**
5144
* Gets a regular expression that identifies strings that may indicate the presence
5245
* of sensitive data, with `classification` describing the kind of sensitive data involved.
@@ -57,8 +50,6 @@ module HeuristicNames {
5750
result = maybeAccountInfo() and classification = SensitiveExpr::id()
5851
or
5952
result = maybePassword() and classification = SensitiveExpr::password()
60-
or
61-
result = maybeCertificate() and classification = SensitiveExpr::certificate()
6253
}
6354

6455
/**

ql/test/query-tests/Security/CWE-798/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ func main() {
5454
i.password = testPassword // OK
5555
secretKey = "secret" // OK
5656
i.password = "--- redacted ---" // OK
57+
certsDir := "/certs" // OK
58+
fmt.Println(certsDir)
59+
accountParameter := "ACCOUNT" // OK
60+
fmt.Println(accountParameter)
5761
}

0 commit comments

Comments
 (0)