Skip to content

feat: expose Elasticsearch through GCP Internal LB, backend keep usin… #3

feat: expose Elasticsearch through GCP Internal LB, backend keep usin…

feat: expose Elasticsearch through GCP Internal LB, backend keep usin… #3

name: Secret Detection
on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]
jobs:
secret-detection:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for common secret patterns
run: |
# Check for common secret file patterns
if find . -name "*.key" -o -name "*.pem" -o -name "*.p12" -o -name "*.pfx" -o -name "*.jks" -o -name "secret*" -o -name "*secret*" | grep -v ".github" | head -1; then
echo "Error: Secret files detected!"
find . -name "*.key" -o -name "*.pem" -o -name "*.p12" -o -name "*.pfx" -o -name "*.jks" -o -name "secret*" -o -name "*secret*" | grep -v ".github"
exit 1
fi
# Check for hardcoded secrets in files
if grep -r -E "(password|pwd|secret|key|token|api_key|apikey|access_key)" --include="*.py" --include="*.js" --include="*.ts" --include="*.yaml" --include="*.yml" --include="*.json" --exclude-dir=".github" --exclude-dir=".git" . | grep -v -E "(#|//|\*)" | head -1; then
echo "Warning: Potential hardcoded secrets found. Please review:"
grep -r -E "(password|pwd|secret|key|token|api_key|apikey|access_key)" --include="*.py" --include="*.js" --include="*.ts" --include="*.yaml" --include="*.yml" --include="*.json" --exclude-dir=".github" --exclude-dir=".git" . | grep -v -E "(#|//|\*)" || true
fi