Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Secret scan (gitleaks)

# Scans only the commits introduced by a PR (gate before merge) so it prevents
# NEW secrets without failing on pre-existing history. Use the manual
# "Run workflow" (workflow_dispatch) for a full-history audit.
on:
pull_request:
workflow_dispatch:

jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run gitleaks
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --no-tags --depth=1 origin "${{ github.base_ref }}"
LOGOPTS="--log-opts=origin/${{ github.base_ref }}..HEAD"
else
LOGOPTS="" # manual run: full-history audit
fi
docker run --rm -v "$GITHUB_WORKSPACE:/repo" ghcr.io/gitleaks/gitleaks:latest \
detect --source=/repo --config=/repo/.gitleaks.toml --redact --verbose --exit-code=1 $LOGOPTS
14 changes: 14 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# gitleaks config — extends the built-in ruleset with project allowlists.
title = "gitleaks config"

[extend]
useDefault = true

[allowlist]
description = "Allowlisted paths and known non-secret placeholders"
paths = [
'''\.env\.example$''',
'''(^|/)env\.example$''',
'''(^|/)README\.md$''',
'''\.gitleaks\.toml$''',
]
Loading