fix(ci): harden GitHub Actions workflows (#208) - #209
Open
hf-security-analysis[bot] wants to merge 1 commit into
Open
hf-security-analysis[bot] wants to merge 1 commit into
hf-security-analysis[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated hardening of the workflow files flagged on #208.
Warning
This changes when the workflow runs and what it can reach. Both triggers and permissions were rewritten in
.github/workflows/deploy-to-hf.yml,.github/workflows/update-conferences.yml,.github/workflows/validate-conferences.yml. Read the diff before merging — either one can change what the workflow is able to do.Targets
dependabot/github_actions/actions-2634b28785. Files changed:.github/workflows/claude-code-review.yml.github/workflows/claude.yml.github/workflows/deploy-to-hf.yml.github/workflows/update-conferences.yml.github/workflows/validate-conferences.ymlFixed by this PR:
unpinned-action(pinact) — .github/workflows/claude-code-review.yml:36broken_auth_gate(claude) — .github/workflows/claude.ymlllm_prompt_injection(claude) — .github/workflows/claude.ymlunpinned-action(pinact) — .github/workflows/claude.yml:29unpinned-action(pinact) — .github/workflows/claude.yml:35unpinned-action(pinact) — .github/workflows/deploy-to-hf.yml:19excessive-permissions(zizmor) — .github/workflows/update-conferences.yml:4unpinned-action(pinact) — .github/workflows/validate-conferences.yml:18unpinned-action(pinact) — .github/workflows/validate-conferences.yml:19excessive-permissions(zizmor) — .github/workflows/deploy-to-hf.yml:1excessive-permissions(zizmor) — .github/workflows/deploy-to-hf.yml:14excessive-permissions(zizmor) — .github/workflows/validate-conferences.yml:1excessive-permissions(zizmor) — .github/workflows/validate-conferences.yml:15This does not fix everything. 2 further finding(s) (2 medium) need a decision this bot should not make for you. They are in the security channel with their locations — deliberately not repeated here, since this repository may be public and they are not fixed yet.
Permissions
.github/workflows/claude-code-review.ymlclaude-reviewcontents: read,id-token: write,issues: read,pull-requests: readactions/checkoutneedscontents: read, and theanthropics/claude-code-actionstep reads PR/issue context and performs an OIDC token exchange (id-token: write); note that if thecode-reviewplugin actually posts its review back to the PR,pull-requests: writewould be required instead of read — that is the one step to verify..github/workflows/claude.ymlclaudeactions: read,contents: read,id-token: write,issues: read,pull-requests: read.github/workflows/deploy-to-hf.ymldeploycontents: read.github/workflows/update-conferences.ymlupdate-conferencescontents: write,pull-requests: writepeter-evans/create-pull-requeststep pushes theupdate-conferencesbranch (contents: write) and opens a PR against main (pull-requests: write); checkout only needs contents: read, and the unverified.github/scripts/update_conferences.pystep appears to only fetch external data and write local files, so a reviewer should confirm it makes no API calls of its own..github/workflows/validate-conferences.ymlvalidatecontents: readactions/checkoutneeds a token scope (contents: read);npm ciandnpm run validatejust run the local validation script (scripts/validate-conferences.ts, not shown here) against the checked-out files and make no API calls, so no write scopes are needed — a reviewer may want to confirm that script does not post PR comments.Anything not listed above keeps the permissions it had. To measure a job this could not read, add
GitHubSecurityLab/actions-permissions/monitorto it and run the workflow — it reports the minimum the run actually used.Pinning changes come from
pinactand are mechanical. Any other change was generated by Claude — read it before merging.