Skip to content

Initialize dependabot/github_actions/actions-bf98f948f2 #2

Initialize dependabot/github_actions/actions-bf98f948f2

Initialize dependabot/github_actions/actions-bf98f948f2 #2

# SPDX-License-Identifier: AGPL-3.0-or-later

Check failure on line 1 in .github/workflows/secret-scanner.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/secret-scanner.yml

Invalid workflow file

(Line: 40, Col: 9): Unrecognized function: 'hashFiles'. Located at position 1 within expression: hashFiles('**/Cargo.toml') != ''
# Prevention workflow - scans for hardcoded secrets before they reach main
name: Secret Scanner
on:
pull_request:
push:
branches: [main]
permissions: read-all
jobs:
trufflehog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
with:
fetch-depth: 0 # Full history for scanning
- name: TruffleHog Secret Scan
uses: trufflesecurity/trufflehog@ef6e76c3c4023279497fab4721ffa071a722fd05 # v3
with:
extra_args: --only-verified --fail
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
with:
fetch-depth: 0
- name: Gitleaks Secret Scan
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Rust-specific: Check for hardcoded crypto values
rust-secrets:
runs-on: ubuntu-latest
if: hashFiles('**/Cargo.toml') != ''
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
- name: Check for hardcoded secrets in Rust
run: |
# Patterns that suggest hardcoded secrets
PATTERNS=(
'const.*SECRET.*=.*"'
'const.*KEY.*=.*"[a-zA-Z0-9]{16,}"'
'const.*TOKEN.*=.*"'
'let.*api_key.*=.*"'
'HMAC.*"[a-fA-F0-9]{32,}"'
'password.*=.*"[^"]+"'
)
found=0
for pattern in "${PATTERNS[@]}"; do
if grep -rn --include="*.rs" -E "$pattern" src/; then
echo "WARNING: Potential hardcoded secret found matching: $pattern"
found=1
fi
done
if [ $found -eq 1 ]; then
echo "::error::Potential hardcoded secrets detected. Use environment variables instead."
exit 1
fi