security(gitleaks): add explicit complete Git history scan alongside PR diff scan
davoodmehraban89 committed
Oct 14, 2026 at 22:37 UTC
e87684dbf826aec6f26b6e9949a19081f794abab
1 file changed
+28
-2
.github/workflows/security-secrets.yml
+28
-2
@@ -17,11 +17,11 @@ concurrency:
17
18
jobs:
19
gitleaks:
20
- name: Scan repository and Git history
20
+ name: Scan incoming commits
21
runs-on: ubuntu-latest
22
timeout-minutes: 60
23
steps:
24
- - name: Checkout full Git history
24
+ - name: Checkout PR history for diff scanning
25
uses: actions/checkout@v6
26
with:
27
fetch-depth: 0
@@ -35,3 +35,29 @@ jobs:
35
GITLEAKS_ENABLE_COMMENTS: "false"
36
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: "false"
37
GITLEAKS_ENABLE_SUMMARY: "false"
38
+
39
+ baseline-history:
40
+ name: Scan complete reachable Git history
41
+ # PR verification tests the imported history immediately; schedule and
42
+ # manual triggers provide follow-up scans after the workflow lands on main.
43
+ if: github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
44
+ runs-on: ubuntu-latest
45
+ timeout-minutes: 90
46
+ steps:
47
+ - name: Checkout full history
48
+ uses: actions/checkout@v6
49
+ with:
50
+ fetch-depth: 0
51
+ persist-credentials: false
52
+ - name: Scan all reachable revisions with redacted output
53
+ shell: bash
54
+ run: |
55
+ set -euo pipefail
56
+ docker run --rm \
57
+ -v "$PWD:/repo:ro" \
58
+ -w /repo \
59
+ -e GIT_CONFIG_COUNT=1 \
60
+ -e GIT_CONFIG_KEY_0=safe.directory \
61
+ -e GIT_CONFIG_VALUE_0=/repo \
62
+ ghcr.io/gitleaks/gitleaks:v8.24.3 \
63
+ detect --source /repo --log-opts="--all" --redact --no-banner --exit-code=1