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

Commit

Permalink
Merge pull request #203 from max/quieten-hard-coded-cred
Browse files Browse the repository at this point in the history
Make HardcodedCredentials query less noisy.
  • Loading branch information
Sauyon Lee authored and GitHub Enterprise committed Dec 11, 2019
2 parents eb639c6 + 75d78b3 commit d3bf87d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ql/src/Security/CWE-798/HardcodedCredentials.ql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* to gain unauthorized access.
* @kind problem
* @problem.severity warning
* @precision high
* @precision medium
* @id go/hardcoded-credentials
* @tags security
* external/cwe/cwe-259
Expand Down
9 changes: 0 additions & 9 deletions ql/src/semmle/go/security/SensitiveActions.qll
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module HeuristicNames {
* user names or other account information.
*/
string maybeAccountInfo() {
result = "(?is).*acc(ou)?nt.*" or
result = "(?is).*(puid|username|userid).*"
}

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

/**
* Gets a regular expression that identifies strings that may indicate the presence of
* a certificate.
*/
string maybeCertificate() { result = "(?is).*(cert)(?!.*(format|name)).*" }

/**
* Gets a regular expression that identifies strings that may indicate the presence
* of sensitive data, with `classification` describing the kind of sensitive data involved.
Expand All @@ -57,8 +50,6 @@ module HeuristicNames {
result = maybeAccountInfo() and classification = SensitiveExpr::id()
or
result = maybePassword() and classification = SensitiveExpr::password()
or
result = maybeCertificate() and classification = SensitiveExpr::certificate()
}

/**
Expand Down
4 changes: 4 additions & 0 deletions ql/test/query-tests/Security/CWE-798/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ func main() {
i.password = testPassword // OK
secretKey = "secret" // OK
i.password = "--- redacted ---" // OK
certsDir := "/certs" // OK
fmt.Println(certsDir)
accountParameter := "ACCOUNT" // OK
fmt.Println(accountParameter)
}

0 comments on commit d3bf87d

Please sign in to comment.