Skip to content

Commit fb737b1

Browse files
chore: sync semgrep.yaml from security-config
1 parent 3bdfe9c commit fb737b1

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

semgrep.yaml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ rules:
4242
4343
If this is a test fixture or example:
4444
- Add comment: # nosemgrep: generic-hardcoded-secret
45-
- Or use obviously fake values: password = "REPLACE_ME"
45+
- Or use obviously fake values: password = "FAKE"
4646
patterns:
4747
- pattern-regex: |-
4848
(?i)(password|passwd|pwd|secret|token|api[_-]?key|private[_-]?key)\s*[:=]+\s*["'][^"']{8,}["']
@@ -71,7 +71,7 @@ rules:
7171
- Enable AWS CloudTrail for key usage monitoring
7272
7373
False Positive: If this is documentation/example, replace with:
74-
AKIAIOSFODNN7EXAMPLE (official AWS example key)
74+
AKIA...EXAMPLE (redacted AWS example key)
7575
pattern-regex: 'AKIA[0-9A-Z]{16}'
7676
metadata:
7777
cwe: "CWE-798"
@@ -773,6 +773,10 @@ rules:
773773
patterns:
774774
- pattern-not: ${{ secrets.$SECRET }}
775775
- pattern-not: ${{ env.$ENV }}
776+
paths:
777+
include:
778+
- "**/.github/workflows/*.yml"
779+
- "**/.github/workflows/*.yaml"
776780
metadata:
777781
cwe: "CWE-798"
778782
category: "security"
@@ -1047,13 +1051,25 @@ rules:
10471051
patterns:
10481052
- pattern-either:
10491053
- pattern: |
1050-
const $VAR = "password"
1051-
- pattern: |
1052-
const $VAR = "secret"
1054+
$VAR := $VALUE
10531055
- pattern: |
1054-
const $VAR = "token"
1056+
const $VAR = $VALUE
10551057
- pattern: |
1056-
var $VAR = "Bearer ..."
1058+
var $VAR = $VALUE
1059+
- metavariable-regex:
1060+
metavariable: $VAR
1061+
regex: (?i)(password|passwd|secret|token|api[_-]?key|private[_-]?key|credentials?)
1062+
- metavariable-regex:
1063+
metavariable: $VALUE
1064+
regex: '"[^"]{8,}"'
1065+
- pattern-not: |
1066+
$VAR := os.Getenv("...")
1067+
- pattern-not: |
1068+
var $VAR = os.Getenv("...")
1069+
- pattern-not: |
1070+
const $VAR = os.Getenv("...")
1071+
- pattern-not: |
1072+
$VAR, $_ := os.LookupEnv("...")
10571073
metadata:
10581074
cwe: "CWE-798"
10591075
owasp: "A07:2021"

0 commit comments

Comments
 (0)