Skip to content

feat(mcp): bind npm publishing to a tag-restricted environment - #359

Merged
bomly-guy merged 1 commit into
mainfrom
feat/mcp-npm-publish-environment
Jul 31, 2026
Merged

feat(mcp): bind npm publishing to a tag-restricted environment#359
bomly-guy merged 1 commit into
mainfrom
feat/mcp-npm-publish-environment

Conversation

@bomly-guy

@bomly-guy bomly-guy commented Jul 31, 2026

Copy link
Copy Markdown
Member

Follow-up to #339, which merged while this was being written.

Why

npm's trusted-publisher form has an optional Environment name field. npm checks it as an OIDC claim, so it only works if the workflow job declares the same environment — and if you set it on npm without the job declaring it, publishing fails.

It is worth setting. Without an environment, the trust grant is "any run of release.yml in this repo may publish to npm". With one, it is "any run of release.yml that reaches the npm-publish environment" — and that environment is restricted to the v* tag pattern, so a push to any branch cannot reach npm.

The trap this avoids

The obvious choice would be the existing release environment. That would have broken every publish: release is scoped to the main branch, and publish-npm runs on a tag ref, so the deployment would be rejected outright. It also carries a required reviewer and a 5-minute wait timer, which are right for cutting a release but wrong for a step inside one.

Hence a separate npm-publish environment, already created on the repo:

env: npm-publish | protection rules: 1
  allows: v* (tag)

npm-side settings

Documented in dev-docs/CI.md so they are not lore:

Field Value
Publisher GitHub Actions
Organization / Repository bomly-dev / bomly-cli
Workflow filename release.yml
Environment name npm-publish
Allowed actions npm publish only — we do not use npm stage publish, so the grant stays minimal
Publishing access Require 2FA and disallow bypass 2fa tokens — the strictest option. Safe because trusted publishers are exempt from it, and it closes off token-based publishing entirely

Also records in SECURITY_ASSURANCE.md that npm publication now holds no credential of any kind, alongside why mcp-publisher is pinned and signature-verified.

Status

bomly-mcp@0.21.1 is already live on npm from the one-time manual bootstrap, so the package exists and the trusted publisher can be configured. This PR is what makes the Environment field safe to fill in.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Security

    • Strengthened npm publishing safeguards with restricted release environments, tag controls, mandatory two-factor authentication, and short-lived OIDC credentials.
    • Added verification requirements for MCP Registry publishing, including version pinning, checksum validation, and signature verification.
  • Documentation

    • Expanded CI and security guidance for trusted publishing setup, release restrictions, and credential protections.

npm's trusted-publisher form takes an optional environment name and
checks it as an OIDC claim, so it only works if the job declares the
same one. Adds `environment: npm-publish` to publish-npm and creates
that environment restricted to the `v*` tag pattern, so publishing to
npm cannot be reached from a branch push.

Deliberately not the existing `release` environment: it is scoped to the
`main` branch, and this job runs on a tag ref, so pointing npm at it
would have rejected every publish.

Documents the exact field values for the npm form in dev-docs/CI.md
(including choosing the strictest Publishing access option, which is
safe because trusted publishers are exempt), and records in
SECURITY_ASSURANCE.md that npm publication now holds no credential.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Bomly Diff Summary

Compared 2f903c9c12da201d4319ce5d8852850a1eb156ca to be319bb11a9158299b786724b7eadfe64acb011b.

Overview

Status Manifests Dependencies Findings Duration
✅ Pass +0 / ~0 / -0 0 added / 0 version changed / 0 detail changes / 0 removed 0 introduced / 0 persisted / 0 resolved 1m 3s

Dependency Changes

✅ No dependency changes.

Vulnerabilities

✅ No vulnerability changes.

License Changes

✅ No license changes.

Project Posture

✅ No project posture changes (--matchers +scorecard was not selected).

Policy Findings

✅ No policy differences were identified.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e262668b-2f3d-44a6-85de-520ef6e8eaf6

📥 Commits

Reviewing files that changed from the base of the PR and between 2f903c9 and be319bb.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • dev-docs/CI.md
  • dev-docs/SECURITY_ASSURANCE.md

📝 Walkthrough

Walkthrough

The release workflow now uses a dedicated npm publishing environment. CI documentation defines trusted-publisher settings, and security documentation records OIDC, tag, 2FA, token, and MCP publisher verification controls.

Changes

NPM publishing controls

Layer / File(s) Summary
Configure npm publishing controls
.github/workflows/release.yml, dev-docs/CI.md, dev-docs/SECURITY_ASSURANCE.md
The publish-npm job now uses the npm-publish environment. Documentation defines OIDC claim matching, tag restrictions, mandatory 2FA, disabled bypass-2FA tokens, and MCP publisher verification steps.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • bomly-dev/bomly-cli#223: Both changes update release workflow and CI documentation, but this PR focuses on npm publishing environment and OIDC controls.
  • bomly-dev/bomly-cli#339: Both changes modify release.yml for npm and MCP publishing workflows.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mcp-npm-publish-environment

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.

@bomly-guy
bomly-guy marked this pull request as ready for review July 31, 2026 07:02
@bomly-guy
bomly-guy merged commit 4f36bac into main Jul 31, 2026
16 checks passed
@bomly-guy
bomly-guy deleted the feat/mcp-npm-publish-environment branch July 31, 2026 07:02
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