Skip to content

ci: isolate OIDC publication from release builds - #113

Merged
abruption merged 4 commits into
mainfrom
ci/99-oidc-publish-boundary
Oct 9, 2026
Merged

abruption merged 4 commits into
mainfrom
ci/99-oidc-publish-boundary

Conversation

@abruption

@abruption abruption commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Build tools and package lifecycle scripts currently run in the job that can request npm publishing OIDC tokens. This moves installation, checks, tests, and packing into a job with read-only contents/pull-request permissions and no OIDC permission. The publishing job downloads the exact smoke-tested tarball by artifact ID, checks its SHA-256, and publishes with lifecycle scripts disabled. Release Please and the release-please.yml Trusted Publisher binding remain in place.

Closes #99.

The build checks that the release tag commit equals GITHUB_SHA, generates the runtime-only shrinkwrap, and retains the very tarball that passed the complete package smoke. The publisher does not check out project source or install project dependencies; only pinned npm 11.11.0, pinned Actions, digest checking, and tarball publication run with OIDC permission.

The required package-smoke aggregate now depends on the npm publication contract check. If a later main push creates a release for an earlier release-PR merge, the source mismatch refuses publication. A documented workflow_dispatch recovery runs on the existing release tag, preserving GitHub's real tag SHA/ref; branch dispatch refuses. Both paths require matching package/Release Please versions, an existing immutable Actions-authored stable release, and its tagged Release Please PR merge commit on main. Arbitrary tags and unmerged sources refuse. No provenance environment is forged and no additional release is created by recovery.

Validation: npm ci, type checking, lint, all 219 tests, package smoke (including the retained-artifact path), and git diff --check passed. Release-source fixtures reject 14 metadata substitutions; read-only metadata from the existing v0.4.4 release and PR #106 passes the same validator. A new CI check runs actual npm 11.11.0 Publish.exec, pacote, libnpmpack, libnpmpublish, and provenance generation with registry/OIDC/signing mocked. It verifies zero lifecycle calls and external requests, byte-identical tarball attachment, matching integrity/provenance SHA-512, and GitHub workflow/source association despite a deliberately conflicting manifest gitHead.

The offline check does not prove real npm authorization, cryptographic signatures, registry acceptance, or npm bin flag parsing. The maintainer guide records source evidence and the attestation/signature checks required at the next authorized release. No real OIDC token was requested and no release or publication was performed. This narrows publishing credentials, but does not claim to prevent a compromised build dependency from altering its own output.

Current head f754d01 has 24/24 successful checks, including CI run 37863459599. The visible Codex review summary still names cc9d823; it is not presented as a review of the subsequent source-authentication correction. The original findings have implementation/test replies, and no further reviewer mentions were posted.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T00:05:19.198053Z cc9d823 Manual request
🔒 Security Review ✅ Completed 2026-10-09T00:08:58.914090Z cc9d823 Manual request

Security findings

Advisory findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 393fb36cc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
Comment on lines +13 to +14
release-contract:
name: release tarball contract

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate merges on the release contract check

This new job is not included in any of the repository's documented required aggregate checks: package-smoke still depends only on package-artifact and git-install, while the maintainer guide lists only supported-tests, lint, security-audit, and package-smoke as branch-protection checks. Consequently, a regression in verify-npm-publication.mjs can leave this job red without blocking a merge, only to fail build-release after Release Please has already created the tag and GitHub release. Add it to a required aggregate dependency or make this job a required status.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Addressed in cc9d823: required package-smoke now depends on release-contract and rejects a non-success result. No repository protection settings were changed.

Comment thread .github/workflows/release-please.yml Outdated
Comment on lines +46 to +47
- name: Require release source to match provenance source
run: test "$(git rev-parse HEAD)" = "$GITHUB_SHA"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent later pushes from stranding the release

When another push to main races the run started by merging the Release Please PR, the later run can be the one that creates the release: Release Please bases releases on the last merged release PR, so its tag still points at that PR's merge SHA while the later run's GITHUB_SHA points at the newer commit (Release Please CLI documentation). This check then fails after the tag and GitHub release already exist; subsequent runs report release_created == false, so neither downstream job runs and ordinary reruns cannot publish that version. Serialize release creation or provide a tag-SHA recovery path before enforcing this equality.

AGENTS.md reference: AGENTS.md:L51-L52

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Addressed in cc9d823 and hardened in f754d01: tag-ref workflow_dispatch recovery preserves GitHub's actual source SHA/ref. It requires an existing immutable Release Please release and the reviewed/tagged release PR merge/version, rather than overriding provenance variables. No recovery run or publication was performed.

@abruption

Copy link
Copy Markdown
Owner Author

@codex review

@abruption

Copy link
Copy Markdown
Owner Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc9d823ff9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +52 to +53
if test "$GITHUB_EVENT_NAME" = workflow_dispatch; then
[[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Authenticate recovery tags before publishing

When a repository writer can create tags, they can point an arbitrary semver-looking tag at any commit containing this workflow and dispatch it; this check proves only that the checkout matches that tag, not that Release Please created the tag and corresponding GitHub release or that the tag matches the package version. GitHub permits workflow_dispatch against any branch or tag after the workflow has run, so this path can obtain the npm OIDC credential and publish outside the reviewed release flow. Require the referenced tag to identify an existing Release Please GitHub release and match package.json, or protect the publish job with an approval environment. GitHub workflow-dispatch documentation

AGENTS.md reference: AGENTS.md:L51-L52

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Addressed in f754d01: read-only source validation requires matching package/Release Please versions, an immutable stable Actions-authored GitHub release, and a tagged Release Please PR whose merge SHA equals the checkout/run SHA on main. Unit fixtures reject 14 substitutions; existing v0.4.4 metadata passes read-only validation. No publishing token or production dispatch was used.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛡️ Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: cc9d823ff9

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

build-release:
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created == 'true' }}
if: ${{ !cancelled() && (needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛡️ Codex Security Review

P2 Badge Security: Authenticate recovery tags before publishing

When release tags are not protected from repository writers, this recovery path lets any writer create vX.Y.Z on an arbitrary commit and dispatch it. The job skips Release Please and accepts every dispatch; the later regex checks only the tag spelling, while HEAD == GITHUB_SHA is naturally true for the attacker's tag. That commit is then packed and the downstream job gets id-token: write and directly publishes through the workflow-scoped npm binding. Protect v* tags from ordinary writers and gate recovery with a protected approval environment; also verify the tag/version against the intended release.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The source gate in f754d01 now requires the existing immutable Release Please release, matching package/version manifest, and its reviewed/tagged merge SHA on main. No environment/protection configuration was modified within this PR. This does not claim to defend against an actor authorized to replace the trusted workflow itself; that remains a repository authorization boundary.

@abruption
abruption merged commit 63445f6 into main Oct 9, 2026
24 checks passed
@abruption
abruption deleted the ci/99-oidc-publish-boundary branch October 9, 2026 04:57
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.

[P2] Separate release build/test execution from OIDC publishing permission

1 participant