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

Commit d3bf87d

Browse files
Sauyon LeeGitHub Enterprise
Sauyon Lee
authored and
GitHub Enterprise
committed
Merge pull request #203 from max/quieten-hard-coded-cred
Make HardcodedCredentials query less noisy.
2 parents eb639c6 + 75d78b3 commit d3bf87d

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

ql/src/Security/CWE-798/HardcodedCredentials.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* to gain unauthorized access.
55
* @kind problem
66
* @problem.severity warning
7-
* @precision high
7+
* @precision medium
88
* @id go/hardcoded-credentials
99
* @tags security
1010
* external/cwe/cwe-259

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)