Skip to content

Commit

Permalink
Only match databases for audit rule
Browse files Browse the repository at this point in the history
  • Loading branch information
LewisArdern committed May 12, 2023
1 parent ab4e1a8 commit 3748d60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/lang/security/audit/database/string-formatted-query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ func dbExec(r *http.Request) {
query := "SELECT number, expireDate, cvv FROM creditcards WHERE customerId = " + customerId

row, _ := db.Exec(query)

// ok: string-formatted-query
out, err := sshClient.Exec(fmt.Sprintf("sudo bash %s", scriptPath))
}

func okDbExec(r *http.Request) {
Expand Down
3 changes: 3 additions & 0 deletions go/lang/security/audit/database/string-formatted-query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ rules:
likelihood: LOW
impact: HIGH
patterns:
- metavariable-regex:
metavariable: $OBJ
regex: (?i).*(db|database)
- pattern-not-inside: |
$VAR = "..." + "..."
...
Expand Down

0 comments on commit 3748d60

Please sign in to comment.