Skip to content

CLOUDPLAT-3162: add npm OIDC publish workflow (s3scan)#36

Merged
haseebehsan merged 2 commits into
masterfrom
cloudplat-3162/add-npm-oidc-publish
Jun 22, 2026
Merged

CLOUDPLAT-3162: add npm OIDC publish workflow (s3scan)#36
haseebehsan merged 2 commits into
masterfrom
cloudplat-3162/add-npm-oidc-publish

Conversation

@haseebehsan

@haseebehsan haseebehsan commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the reusable workflow-npm-oidc-publish workflow from mapbox/gha-public.

This replaces local/manual npm publish with a GitHub Actions workflow using OIDC Trusted Publishing — no npm tokens required.

Trigger: manual (workflow_dispatch) — run from the Actions tab to publish.

Ticket: https://mapbox.atlassian.net/browse/CLOUDPLAT-3162

@haseebehsan haseebehsan added the ai AI coding agents co-authored the code label Jun 18, 2026
@haseebehsan haseebehsan requested a review from a team as a code owner June 18, 2026 09:17
@haseebehsan haseebehsan added the ai AI coding agents co-authored the code label Jun 18, 2026
@ox-security

ox-security Bot commented Jun 18, 2026

Copy link
Copy Markdown

OX Security Logo

Successfully scanned changes introduced in a pull request into master from cloudplat-3162/add-npm-oidc-publish.

Internal scan identifier: 7cfedbf5-849e-4ce5-9cfc-23a945c6a0b2.

Total issues Blocking issues Scan status
1 0 ✔️
Category Issues
CI/CD Posture 1

See all issues found during this scan in the OX Security Application.

Detailed information
Issue #1
NameUnpinned Reusable Workflow • GitHub Actions
StatusNew
EnforcementMonitor
SeverityHigh
CategoryCI/CD Posture
Source toolsOX CI/CD Posture
RecommendationPin reusable workflows to a full-length commit SHA (40 characters) instead of a tag or branch. Example: uses: org/repo/.github/workflows/build.yml@a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0
1 aggregation
FileMatch
.github/workflows/npm-release.ymluses: mapbox/gha-public/.github/workflows/workflow-npm-oidc-publish.yml@main

@haseebehsan haseebehsan merged commit 5a01c33 into master Jun 22, 2026
5 checks passed
Comment thread CONTRIBUTING.md
### Steps

1. **Bump the version** in `package.json` (follow [semver](https://semver.org))
2. **Update `CHANGELOG.md`** with a summary of what changed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no CHANGELOG.md in most of the repos this PR template was submitted to — the more common practice is to maintain changelogs in the GitHub Releases section, so this item doesn't make sense.

Comment thread package.json
"underscore": "^1.13.6"
},
"publishConfig": {
"access": "public"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow already passes the public tag (npm publish --access public), so this change is fully redundant.

Comment thread package.json
{
"name": "@mapbox/s3scan",
"version": "3.0.0",
"version": "3.0.1",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is zero reason to bump versions in this PR template because changing the workflow does not change the package contents itself — instead of asking every receiver of these PRs to "remove the bump if you don't need it" (which is a lot of manual labor), it should have been the other way around (but I really can't think of any reason such a PR would need a version bump, except to test out the workflow immediately with a vain version).


jobs:
npm-release:
uses: mapbox/gha-public/.github/workflows/workflow-npm-oidc-publish.yml@main

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ox-security is right — it's fragile to have this unpinned / not versioned; even an inconspicuous-looking update of the workflow can break releases across hundreds of repos.

id-token: write
contents: write
with:
create-github-release: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might make sense for private packages, but it's a questionable default for public projects, where it's important to have release notes written with care, not auto-generated from commits.

Comment thread CONTRIBUTING.md

### Steps

1. **Bump the version** in `package.json` (follow [semver](https://semver.org))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to follow common practices, a release should be 1) tagged, 2) marked with a clear semver commit. So npm version is a more universal instruction.

Comment thread CONTRIBUTING.md

The workflow will publish to npm and create a GitHub release with auto-generated notes.

> **Note:** Only Mapbox maintainers with write access to this repository can trigger the release workflow. External contributors can open and contribute to PRs, but releases are always cut by the owning team.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole note feels redundant. Does it really need clarification that external PR authors can't publish NPM releases by themselves, and only package maintainers can actually do that?


jobs:
npm-release:
uses: mapbox/gha-public/.github/workflows/workflow-npm-oidc-publish.yml@main

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a few comments on the workflow itself to keep my feedback in one review:

  • Node version should be v24, the current LTS. v22 is in maintenance mode. Subsequently, there'd be no need to do npm install -g npm@^11.5.1 because v24 comes with v11.6.0+ bundled.
  • "Run tests" and "Build package" should not be in the workflow. Gating and preparing assets before publish is the responsibility of prepublishOnly hook in package.json.
  • "Build package" runs unconditionally, which makes it run twice if a package does have prepublishOnly set up properly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this workflow seems redundant as a whole. You have a 146-line boilerplate running typical workflow things like npm ci and tests with a lot of verbose options, but there's no value in it being reusable because you can replace the composition of this uses workflow and the dependency with a compact 17-line self-sufficient workflow that is much easier to maintain and less fragile. This push was about switching to OIDC publishing specifically, so it doesn't warrant pushing projects towards more complicated workflows with logic unrelated to OIDC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai AI coding agents co-authored the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants