-
Notifications
You must be signed in to change notification settings - Fork 85
Add gitleaks secret-scan CI #2362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: secrets_scan | ||
| on: | ||
| push: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: gitleaks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: scan for secrets (gitleaks) | ||
| run: docker run -v "$PWD:/code" -w /code ghcr.io/gitleaks/gitleaks:v8.30.1 dir -v --baseline-path /code/gitleaks-baseline.json | ||
|
Comment on lines
+14
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Prompt To Fix With AIThis is a comment left during a code review.
Path: .github/workflows/secrets-scan.yml
Line: 14-16
Comment:
**`dir` mode skips git history; `fetch-depth: 0` is unused overhead**
The `dir` subcommand scans only the files present in the working tree. Any secret committed to a prior commit and then removed (or never appearing in the final tree state) will not be detected, even though `fetch-depth: 0` fetches the complete history. For SOC 2 coverage, the `git` subcommand (or `detect --source .`) scans every commit in range and would catch secrets that existed even briefly. If `dir` mode is intentional (simpler baseline management), `fetch-depth: 0` can be dropped to `fetch-depth: 1` to avoid cloning the full history needlessly.
How can I resolve this? If you propose a fix, please make it concise. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ghcr.io/gitleaks/gitleaks:v8.30.1uses a semver tag, which can be overwritten on the registry at any time. For a security-scanning step this creates a supply-chain risk: a compromised or repointed tag would silently replace the scanner with untrusted code. Pin to the image digest instead, e.g.ghcr.io/gitleaks/gitleaks:v8.30.1@sha256:<digest>.Prompt To Fix With AI