Repository navigation
ci: pin third-party actions to commit SHAs - #20
Conversation
There was a problem hiding this comment.
🤖 NCode Review at 99403f2: 1 new finding on the changed lines.
Not on a changed line:
- 🟠 F1 Should fix: Checkout steps leave the job token in .git/config
.github/workflows/main.yml:26. None of the actions/checkout steps (lines 26, 57, 85) setpersist-credentials: false, so in the publish job, which hascontents: write, a token with write access stays in .git/config. Fix: Addwith: persist-credentials: falseto each checkout step, unless a later step really needs to push. This PR doesn't change these lines, so it can go here or in a follow-up. - 🟡 F2 Nit: Are first-party actions meant to stay on tags? ci.yml already pins them
.github/workflows/main.yml:26. actions/checkout@v7 (lines 26, 57, 85), actions/setup-dotnet@v6 (lines 28, 63, 95), actions/upload-artifact@v7 (line 41) and actions/download-artifact@v8 (lines 59, 87) are still on mutable tags, but ci.yml and code-review.yml pin checkout and setup-dotnet to SHAs. Fix: Pin the remaining actions using the SHAs already in ci.yml (checkout 3d3c42e5…, setup-dotnet a98b5685…) plus SHAs for upload/download-artifact. Or, if first-party actions are deliberately left on tags, say so in the PR description. - 🟡 F3 Nit: Publish step: stored API key, no --skip-duplicate, no .snupkg push, no version/tag check
.github/workflows/main.yml:99. The publish step (not changed by this PR) pushes only *.nupkg usingsecrets.NUGET_APIKEY, without--skip-duplicate, without pushing the .snupkg files, and without checking that the package versions match the release tag. Fix: Is this in scope for a later hardening PR? If so: switch to NuGet trusted publishing via OIDC, add--skip-duplicate, push the .snupkg files, and check versions against the tag before pushing.
|
Superseded by the review at 10bfa2d. |
|
Autopilot: Answering the NCode Review summary and review (F1-F4).
I also removed the generated-by line from the PR description, which made the required Commit attribution check fail; editing the description re-runs it. PR #20 is behind Generated by Claude Code |
|
/review |
🤖 Review completeVerdict: ✅ Approve — Re-review of what changed since the last review at 99403f2: 3 hunks in 1 file, by correctness only. No further findings above nits. 1 reviewer run — 0 findings (run details)
Trial: findings are posted as review threads and in the check run. $0.01 on Amazon Bedrock, 11s, at 10bfa2d. (how to interact) 📋 OutcomesMerged at abd565c: 0 fixed, 1 dismissed, 0 acknowledged, 0 ignored.
|
Why
CodeQL's extended query suite, now on for every NCodeGroup repository, reports a third-party action referenced by a tag as
actions/unpinned-tag: whoever controls that repository can move the tag, and the step runs with this workflow's token and secrets. A full commit SHA is the one reference nobody can move.Changes
Third-party actions are pinned to the commit SHA of the release their tag pointed at, with the release in a comment, so Dependabot's
github-actionsupdates keep bumping them (it updates the SHA and the comment together). Behavior is unchanged: each SHA is the commit the tag resolves to today.Verified
Each SHA was resolved from the tag with
gh api repos/<action>/commits/<tag>and matched to the release tag withgit ls-remote --tags. The CodeQL alerts for these lines close when this merges.