S-125938: Add gitleaks secret scanning - #2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3fad83654
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| run: | | ||
| if ! git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null; then | ||
| BASE_SHA="$HEAD_SHA~1" |
There was a problem hiding this comment.
Avoid falling back to scanning only the last pushed commit
When BASE_SHA is not present in the checkout, such as a created/recreated main branch or a force-push whose old tip is no longer fetched, this fallback narrows the scan to HEAD_SHA~1..HEAD_SHA. The next command passes that range to Gitleaks via --log-opts, so any secret introduced in earlier commits from the same pushed update is never examined; for a secret scanner, it is safer to fetch the missing base, scan the full reachable history for that push, or fail closed instead of scanning only one commit.
Useful? React with 👍 / 👎.
Summary
Test plan
Part of S-125938
Agent Audit