Skip to content

fix(ci): stop persisting a write-scoped git credential through npm ci - #46

Open
asachs01 wants to merge 1 commit into
mainfrom
fix/release-persist-credentials
Open

fix(ci): stop persisting a write-scoped git credential through npm ci#46
asachs01 wants to merge 1 commit into
mainfrom
fix/release-persist-credentials

Conversation

@asachs01

@asachs01 asachs01 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Closes a real CodeRabbit finding (CWE-250) in this repo's release workflow.

The issue

The release job declares:

permissions:
  contents: write

That overrides this repo's read-only default_workflow_permissions. So actions/checkout's default persisted credential is write-scoped, and it sits in .git/config through npm 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: false on 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 from GITHUB_TOKEN rather than relying on the checkout credential. persist-credentials: false is semantic-release's own documented GitHub Actions recipe.

Verified before pushing: YAML parses, the change lands on the release job's checkout only, and actionlint is clean.

Consistency

node-syncro, node-atera and node-connectwise-automate already do this. This brings the remaining four SDK repos in line.

🤖 Generated with Claude Code

https://claude.ai/code/session_0154CagrzaLihv19SKENWpKQ


View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.

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
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5a5d9339-6542-46d4-b61c-45d43a313c9c


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant