Skip to content

Commit 6f7b095

Browse files
Ianjensenisme/111 secure archives (#274)
* Switching gitleaks scanning to the command-line tool to add archive depth configurability. * Add gitleaks scan to pre-commit-config * Version fix, precommit setup
1 parent f83cb96 commit 6f7b095

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

.github/workflows/azure-dev.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,26 @@ jobs:
5555

5656
- name: Install GitLeaks
5757
run: |
58-
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.17.0/gitleaks_8.17.0_linux_x64.tar.gz -o gitleaks.tar.gz
58+
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_linux_x64.tar.gz -o gitleaks.tar.gz
5959
tar -xzf gitleaks.tar.gz
6060
chmod +x gitleaks
6161
sudo mv gitleaks /usr/local/bin/
6262
rm gitleaks.tar.gz
6363
gitleaks version
6464
65+
- name: Run GitLeaks Scan
66+
env:
67+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
68+
run: |
69+
gitleaks detect \
70+
--verbose \
71+
--max-archive-depth 50 \
72+
--report-format sarif \
73+
--report-path ./gitleaks-report.sarif \
74+
--source . \
75+
--exit-code 0 || true
76+
echo "GitLeaks scan completed"
77+
6578
- name: Setup .NET SDK
6679
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
6780
with:

.github/workflows/terraform-validate.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,37 @@ jobs:
119119

120120

121121

122+
- name: Install GitLeaks
123+
run: |
124+
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_linux_x64.tar.gz -o gitleaks.tar.gz
125+
tar -xzf gitleaks.tar.gz
126+
chmod +x gitleaks
127+
sudo mv gitleaks /usr/local/bin/
128+
rm gitleaks.tar.gz
129+
gitleaks version
130+
122131
- name: GitLeaks Scan
123132
id: gitleaks
124-
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
125133
env:
126134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127135
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
128-
with:
129-
verbosity: "info"
130-
report-format: "sarif"
131-
report-path: "./gitleaks-report.sarif"
136+
run: |
137+
echo "Running GitLeaks scan with max archive depth..."
138+
gitleaks detect \
139+
--verbose \
140+
--max-archive-depth 50 \
141+
--report-format sarif \
142+
--report-path ./gitleaks-report.sarif \
143+
--source . \
144+
--exit-code 0 || true
145+
echo "GitLeaks scan completed"
132146
133147
- name: Upload GitLeaks SARIF report
134148
if: success() || failure() # Upload even if GitLeaks finds issues
135149
uses: github/codeql-action/upload-sarif@9b02dc2f60288b463e7a66e39c78829b62780db7 # v2.22.1
136150
with:
137151
directory: ./ # Ensure the report path is correct
138-
sarif_file: results.sarif
152+
sarif_file: gitleaks-report.sarif
139153
category: gitleaks
140154

141155
- name: Run Checkov action

.pre-commit-config.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ repos:
2424
- id: terraform_validate
2525
args: [infra]
2626

27-
- repo: https://github.com/gitleaks/gitleaks
28-
rev: v8.18.2
27+
- repo: local
2928
hooks:
30-
- id: gitleaks
29+
- id: gitleaks
30+
name: Detect hardcoded secrets in staged files
31+
entry: gitleaks
32+
args: ['detect', '--verbose', '--max-archive-depth=50', '--no-git']
33+
language: system
34+
pass_filenames: true

0 commit comments

Comments
 (0)