fix(ci): stop persisting a write-scoped git credential through npm ci - #46
Open
asachs01 wants to merge 1 commit into
Open
fix(ci): stop persisting a write-scoped git credential through npm ci#46asachs01 wants to merge 1 commit into
asachs01 wants to merge 1 commit into
Conversation
The release job declares contents: write, which overrides this repo's read-only default workflow permission. So actions/checkout's default persisted credential is WRITE-scoped and stays in .git/config through npm ci, build and test -- readable off disk by any compromised dependency lifecycle script, which could use it to push. semantic-release authenticates its own pushes from GITHUB_TOKEN and never needed the persisted credential; persist-credentials: false is its own documented GitHub Actions recipe. Verified: this repo uses @semantic-release/git, so the push path is semantic-release's, not the checkout credential's. Matches the pattern already in node-syncro, node-atera and node-connectwise-automate. CWE-250, flagged by CodeRabbit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0154CagrzaLihv19SKENWpKQ
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Closes a real CodeRabbit finding (CWE-250) in this repo's release workflow.
The issue
The release job declares:
That overrides this repo's read-only
default_workflow_permissions. Soactions/checkout's default persisted credential is write-scoped, and it sits in.git/configthroughnpm ci, build and test. Any compromised dependency lifecycle script in that window can read it off disk and push to the repo.This is why the repo-level read-only default does not mitigate it here — worth noting, because it does mitigate the equivalent finding in
ci.yml.The fix
persist-credentials: falseon the release job's checkout only. The test job is untouched.This is safe here specifically because this repo uses
@semantic-release/git: semantic-release authenticates its own pushes fromGITHUB_TOKENrather than relying on the checkout credential.persist-credentials: falseis semantic-release's own documented GitHub Actions recipe.Verified before pushing: YAML parses, the change lands on the release job's checkout only, and
actionlintis clean.Consistency
node-syncro,node-ateraandnode-connectwise-automatealready do this. This brings the remaining four SDK repos in line.🤖 Generated with Claude Code
https://claude.ai/code/session_0154CagrzaLihv19SKENWpKQ
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.