-
Notifications
You must be signed in to change notification settings - Fork 8
chore: add OIDC Trusted Publisher for NPM #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add OIDC permissions (id-token: write, contents: read) - Update to actions/setup-node@v4 and Node 20 - Add npm update step to ensure npm 11.5.1+ - Remove NODE_AUTH_TOKEN (OIDC handles authentication) - Update documentation to mention OIDC publishing
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughMigrates NPM publishing authentication from token-based to OIDC Trusted Publisher in GitHub Actions. Updates Node setup action from v3 to v4, upgrades Node.js version from 18 to 20, and adds npm update step. Documentation reflects these authentication changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes The changes are primarily configuration updates and documentation clarifications. The workflow modifications are straightforward: permission additions, action version upgrades, and environment variable removal. Documentation updates are minor and consistent. No complex logic or behavioral changes requiring deep analysis. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR transitions NPM package publishing from long-lived token authentication to OpenID Connect (OIDC) Trusted Publisher for improved security. The change eliminates the need for manually managed NODE_AUTH_TOKEN secrets by leveraging GitHub's OIDC identity tokens.
Key changes:
- Added OIDC permissions (
id-token: write) to the workflow for token-less authentication - Upgraded Node.js from version 18 to 20 and setup-node action from v3 to v4
- Removed NODE_AUTH_TOKEN secret references from publish steps
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/npm-publish.yaml | Added OIDC permissions, upgraded Node/npm versions, removed token-based authentication |
| README.md | Updated deployment documentation to mention OIDC authentication |
| CONTRIBUTING.md | Updated release documentation to clarify token-less publishing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/npm-publish.yaml (2)
38-40: npm upgrade is necessary for OIDC support.Installing
npm@latestensures OIDC support (npm 11.5.1+), and step placement is correct. Consider pinning to a minimum version (e.g.,[email protected]) for reproducibility, but@latestis pragmatic for a maintained tool.Consider using an explicit version constraint for enhanced reproducibility:
- - name: Update npm - run: npm install -g npm@latest + - name: Update npm for OIDC support + run: npm install -g [email protected]
1-66: Verify Trusted Publishers are configured on npmjs.com.The workflow now uses OIDC for authentication, which requires that each package in the matrix is registered as a Trusted Publisher on npmjs.com. This is an out-of-band prerequisite that must be completed before this workflow can successfully publish.
Before merging, ensure the following packages are configured as OIDC Trusted Publishers on npmjs.com:
- @requestnetwork/add-stakeholder
- @requestnetwork/create-invoice-form
- @requestnetwork/invoice-dashboard
- @requestnetwork/payment-widget
- @requestnetwork/single-invoice
Reference: npmjs.com Trusted Publishers documentation
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/npm-publish.yaml(2 hunks)CONTRIBUTING.md(1 hunks)README.md(1 hunks)
🔇 Additional comments (5)
CONTRIBUTING.md (1)
36-36: Documentation accurately reflects OIDC authentication change.The update clearly communicates that OIDC Trusted Publisher is now used and that manual tokens are no longer required. This provides helpful context for contributors.
README.md (1)
91-91: Documentation updates are clear and consistent.The release instructions now clearly specify OIDC Trusted Publisher authentication, and the typo correction improves readability. Both changes align with the workflow migration and contribute guide updates.
Also applies to: 93-93
.github/workflows/npm-publish.yaml (3)
11-13: OIDC permissions are correctly scoped.The
id-token: writepermission is required for OIDC token generation, andcontents: readaligns with the checkout step's requirements. Workflow-level permissions follow least-privilege principles.
33-33: Action and runtime versions are appropriate.Upgrading to
setup-node@v4(current major version) and Node.js 20 is timely, especially since Node 18 reached EOL in March 2025. No compatibility concerns expected for the publish workflow.Also applies to: 35-35
59-66: NODE_AUTH_TOKEN successfully removed from all publish steps.Verification confirms that
NODE_AUTH_TOKENhas been completely removed from the workflow, and OIDC permissions are correctly configured withid-token: write. The publish steps only referenceVITE_WEB3MODAL_PROJECT_ID, allowing npm to automatically authenticate using OIDC tokens. The workflow is properly configured for OIDC-based package publishing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this, changes look sensible and everything builds so we can 🚢
Problem
NPM package publishing uses long-lived tokens (NODE_AUTH_TOKEN) which pose security risks if compromised or exposed.
Solution
Considerations
Summary by CodeRabbit
Documentation
Chores