Skip to content

ci(release): guard the dispatch, fail closed on re-publish, attest the payload - #112

Merged
lidge-jun merged 1 commit into
devfrom
codex/release-dispatch-hardening
Sep 9, 2026
Merged

ci(release): guard the dispatch, fail closed on re-publish, attest the payload#112
lidge-jun merged 1 commit into
devfrom
codex/release-dispatch-hardening

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

What

Hardens release.yml against the three publication risks a non-npm artifact actually has. codexclaw is not npm-published (private: true); its distribution is GitHub Releases + tags + the plugin payload tarball, so npm-specific gates (Trusted Publishing, dist-tags, registry version checks) deliberately do not apply — this PR ports their equivalents.

  1. Dispatch guard (expected-sha + main-only). Today a workflow_dispatch publishes whatever the selected ref's HEAD is at run time. A new required expected_sha input plus a refs/heads/main-only dispatch check refuse to publish an unaudited or moved commit. (opencodex equivalent: release-dispatch-guard.cjs; here a plain shell guard, no new script surface.)
  2. Fail-closed re-publish. A preflight step refuses: a tag pointing at a different SHA; on the dispatch path, any pre-existing tag; and a GitHub Release that already carries assets. gh release upload loses --clobber, so a duplicate asset name fails loudly instead of silently overwriting the payload users installed. A zero-asset pre-existing release is treated as an incomplete earlier attempt and resumed.
  3. Build provenance attestation. npm publishers get Sigstore provenance from Trusted Publishing; the tarball equivalent is actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 (v4.2.2, SHA-pinned) over dist-artifacts/, with new workflow-level id-token: write + attestations: write grants. This binds the payload, SHA256SUMS, and the candidate manifest to the workflow run identity.

Also: post-publish verification now rejects an empty release-notes body (it previously only counted assets).

Out of scope (deliberate)

  • No version-line/dev-ahead interlock or dev-version-bump workflow: codexclaw's release version comes from the dispatch input/tag, not the tree, so the failure mode that opencodex's bump workflow repairs does not exist here.
  • No changelog builder: --generate-notes stays; the non-empty-body check is the floor.

Verification

  • actionlint .github/workflows/release.yml — no findings on the new steps (two SC2129 style notes pre-date this change; same steps, shifted line numbers).
  • gate.mjs OK.
  • Publish-path behavior is exercised end-to-end on the next tag/dispatch; the guard paths are fail-closed shell with set -euo pipefail.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 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-09-09T05:39:05.886218Z 61ca6f7 PR opened
ℹ️ 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.

…e payload

Three publication risks in the release train, closed:

- workflow_dispatch published whatever the selected ref's HEAD was at
  run time. A required expected_sha input plus a main-only dispatch
  guard now refuse to publish an unaudited or moved commit.
- Re-dispatching an already-released version silently overwrote the
  shipped tarball via upload --clobber. A preflight now refuses a
  pre-existing tag (dispatch path) or a release that already carries
  assets, and the upload drops --clobber so a duplicate asset name
  fails loudly. A zero-asset release is treated as an incomplete
  attempt of the same publish and resumed.
- The tarball had SHA256SUMS but nothing binding those sums to the
  builder identity. npm gets this from Trusted Publishing; the non-npm
  equivalent is actions/attest-build-provenance (SHA-pinned v4.2.2)
  over dist-artifacts/, backed by new id-token/attestations grants.

Post-publish verification now also rejects an empty release-notes body.

actionlint: clean (the two SC2129 style notes pre-date this change,
same steps shifted down).
@lidge-jun
lidge-jun force-pushed the codex/release-dispatch-hardening branch from 87f1db4 to 9d3159e Compare September 9, 2026 15:11
@lidge-jun
lidge-jun merged commit fc12bde into dev Sep 9, 2026
10 checks passed
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