Skip to content

feat: suggest SHA-pinned GitHub Actions updates instead of bare tags - #17

Merged
algomaster99 merged 2 commits into
mainfrom
feat/ghactions-sha-pin-suggestion
Aug 16, 2026
Merged

feat: suggest SHA-pinned GitHub Actions updates instead of bare tags#17
algomaster99 merged 2 commits into
mainfrom
feat/ghactions-sha-pin-suggestion

Conversation

@algomaster99

Copy link
Copy Markdown
Member

Summary

yul's GitHub Actions checker now resolves the commit SHA behind a newly-released tag and suggests pinning to @<sha> # vX.Y.Z instead of the bare tag - the security-recommended convention this repo's own workflows (.github/workflows/*.yml) already use.

Before:

outdated dependencies, use these versions instead:
  actions/checkout  v4 -> v6.0.1

After:

outdated dependencies, use these versions instead:
  actions/checkout  v4 -> 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

Changes

  • pkg/githubactions/sha.go (new): ShaResolver interface + GitHubShaResolver, resolving a tag's commit SHA via the GitHub REST API (GET /repos/{repo}/commits/{tag}), honoring GITHUB_TOKEN for a higher rate limit if set.
  • pkg/util/mismatch.Mismatch: new optional Suggested field carrying the exact replacement text, used only by the GitHub Actions checker.
  • pkg/githubactions/workflow.go: Checker gained a Sha ShaResolver field; CheckWorkflow sets Mismatch.Suggested to "<sha> # <tag>" when resolution succeeds. A failed SHA lookup fails open - the mismatch is still reported with the plain tag, same treatment as other resolver errors in this codebase.
  • main.go: wires up githubactions.GitHubShaResolver{}; both the PreToolUse hook's stderr message and the session-start scan's additionalContext prefer Suggested over Latest when present.

🤖 Generated with Claude Code

yul's GitHub Actions checker now resolves the commit SHA behind a
newly-released tag and suggests `@<sha> # vX.Y.Z` as the replacement,
matching the security-recommended pin convention this repo's own
workflows already use, instead of just bumping to the bare tag.

Mismatch gained an optional Suggested field carrying that exact
replacement text; the hook's stderr message and the session-start
scan's additionalContext both prefer it over Latest when set. A failed
SHA lookup fails open, same as other resolver errors here: the
mismatch is still reported, just without the SHA suggestion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@algomaster99
algomaster99 requested a lite review from Copilot August 16, 2026 19:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread pkg/githubactions/sha.go Outdated
Comment thread pkg/githubactions/sha.go Outdated
Comment thread pkg/githubactions/sha.go Outdated
Comment thread pkg/githubactions/workflow.go Outdated
Comment thread pkg/githubactions/workflow_test.go Outdated
Comment thread pkg/util/mismatch/mismatch.go Outdated
Trim redundant doc comments, add an example to repoOf's, rename
fakeShaResolver to mockShaResolver, and tighten Mismatch.Suggested's
doc comment per algomaster99's review.
@algomaster99
algomaster99 marked this pull request as ready for review August 16, 2026 19:14
@algomaster99
algomaster99 merged commit 8c3cf6a into main Aug 16, 2026
2 checks passed
@algomaster99
algomaster99 deleted the feat/ghactions-sha-pin-suggestion branch August 16, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants