Skip to content

Commit 8dd0ed7

Browse files
committed
secret-guard update
1 parent 8af4588 commit 8dd0ed7

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

plugins/secret-guard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Prevents accidental commits of hardcoded secrets, API keys, and credentials by s
2222
## Requirements
2323

2424
- **`jq`** must be installed for JSON parsing
25-
- **`grep -P`** (PCRE support) must be available (default on most Linux systems)
25+
- **`grep -E`** (extended regex) must be available (default on Linux and macOS)
2626

2727
## How it works
2828

plugins/secret-guard/hooks/scan-secrets.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ fi
1919
patterns=(
2020
'AKIA[0-9A-Z]{16}'
2121
'aws_secret_access_key'
22-
'api[_\-]?key\s*[:=]\s*['"'"'"][a-zA-Z0-9]'
23-
'bearer\s+[a-zA-Z0-9_\-\.]+'
24-
'BEGIN\s+(RSA\s+|EC\s+|DSA\s+|OPENSSH\s+)?PRIVATE\s+KEY'
22+
'api[_\-]?key[[:space:]]*[:=][[:space:]]*['"'"'"][a-zA-Z0-9]'
23+
'bearer[[:space:]]+[a-zA-Z0-9_\-\.]+'
24+
'BEGIN[[:space:]]+(RSA[[:space:]]+|EC[[:space:]]+|DSA[[:space:]]+|OPENSSH[[:space:]]+)?PRIVATE[[:space:]]+KEY'
2525
'sk-[a-zA-Z0-9]{20,}'
2626
'gh[pousr]_[a-zA-Z0-9]{36,}'
27-
'secret[_\-]?key\s*[:=]\s*['"'"'"][a-zA-Z0-9]'
28-
'password\s*[:=]\s*['"'"'"][^'"'"'"]{8,}'
27+
'secret[_\-]?key[[:space:]]*[:=][[:space:]]*['"'"'"][a-zA-Z0-9]'
28+
'password[[:space:]]*[:=][[:space:]]*['"'"'"][^'"'"'"]{8,}'
2929
'://[^:]+:[^@]+@'
3030
)
3131

3232
found=false
3333
for pattern in "${patterns[@]}"; do
34-
if echo "$content" | grep -qPi "$pattern" 2>/dev/null; then
34+
if echo "$content" | grep -qEi "$pattern"; then
3535
found=true
3636
break
3737
fi

0 commit comments

Comments
 (0)