Skip to content

Harden release workflow verification - #10

Merged
FlyOverCoderKY merged 7 commits into
mainfrom
claude/harden-release-workflow
Nov 6, 2026
Merged

FlyOverCoderKY merged 7 commits into
mainfrom
claude/harden-release-workflow

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Summary

  • verify stable release refs before repository checkout
  • publish only validated prepared bytes from an isolated final job
  • rebuild package output cleanly and enforce the exact release file inventory

Validation

  • CI=1 pnpm run format:check
  • CI=1 pnpm run check
  • CI=1 pnpm test
  • CI=1 pnpm run release:check
  • CI=1 pnpm run release:pack -- -- --output .release

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

OpenRouter review posted (clean). #10 (review)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 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
🔒 Security Review ✅ Completed 2026-11-06T17:58:26.331605Z f6a271f 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.

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: f6a271f1db1cc491a5850c0f4adbe7a836fe1240
Judge: openai/gpt-5.6-luna
Cost: $0.2882 (lanes $0.2806 + judge $0.0075)

Lanes

  • meta/muse-spark-1.2: ok (5 finding(s), 84.9s, 196924+12152 tokens (69858 cached), 4 tool round(s), via Meta, $0.22)
  • z-ai/glm-5.3-flash: ok (9 finding(s), 305.4s, 861243+50630 tokens (638976 cached), 13 tool round(s), via CoreWeave, $0.0597)

Warning

z-ai/glm-5.3-flash: coverage claims 6 finding(s) in '.github/workflows/publish.yml' but 5 were reported

Findings

🔵 Issue 1 — Inconsistent npm install hardening between CI and publish preparation

.github/workflows/ci.yml:27 · nit · identified by meta/muse-spark-1.2

Concrete scenario: publish.yml prepare hardens the npm bootstrap with --ignore-scripts --registry https://registry.npmjs.org/ while ci.yml (and the Use the reviewed npm release step in general) still runs npm install --global npm@​11.18.0 without those flags. An attacker who compromises the npm registry response or a lifecycle script in the npm package itself could execute code in CI but not in the release job, breaking the "reviewed npm release" guarantee that the docs and tests claim is uniform.

Evidence: publish.yml:97 now uses npm install --global npm@​11.18.0 --ignore-scripts --registry https://registry.npmjs.org/; ci.yml:27 remains npm install --global npm@​11.18.0. The test installs the reviewed npm before every CI matrix gate only checks the prefix, not the flags.

Checked: sibling workflows ci.yml, publish.yml, codeql.yml; docs/RELEASING.md bootstrap steps still pin registry and --ignore-scripts; no test asserts flag parity.

🟠 Issue 2 — Dead intermediate build after second clean in prepareRelease

scripts/release-packages.mjs:956 · risk · identified by meta/muse-spark-1.2

Concrete scenario: prepareRelease now does clean → build → clean → npm pack. The second cleanPackageBuildOutputs() deletes dist/ and tsconfig.tsbuildinfo immediately after the explicit npm --prefix run build, making that build dead code. The final artifact relies entirely on npm pack's implicit prepack (tsc -p tsconfig.json) to rebuild. If packages/mail/package.json:prepack is ever renamed, removed, or bypassed with --ignore-scripts, the pack will publish an empty or stale dist/ and only fail later at verifyPackedFiles, wasting CI and obscuring the root cause.

Evidence: scripts/release-packages.mjs:955-962 – first cleanPackageBuildOutputs, runPublicRegistryNpm(["--prefix", root, "run", "build"]), second cleanPackageBuildOutputs before runPublicRegistryNpm(["pack", ...]). prepareBootstrap reuses the same path. Docs claim "removes prior build output ... before a fresh build" (singular) while code does it twice.

Checked: package.json prepack, scripts/release-packages.mjs:802-827 pack flow, tests/release-packages.test.ts:892-915 stale-output assertion expects both dist/stale.js and tsconfig.tsbuildinfo to be gone, which the double-clean satisfies but hides the redundant build.

🔵 Issue 3 — Allowed-signers file reused without existence check in second fetch

.github/workflows/publish.yml:79 · nit · identified by meta/muse-spark-1.2

Concrete scenario: publish.yml prepare job writes the allowed-signers file in Verify the release ref (printf ... > "${allowed_signers}") and reuses the same path in Fetch verified release refs via git config --local gpg.ssh.allowedSignersFile "${allowed_signers}" without verifying the file still exists or has 0600. If the runner ever cleans RUNNER_TEMP between steps or the first step's trap is extended to delete it, the second git fetch and later validateSignedTag (which runs git verify-tag --raw) will fail with a confusing "allowedSignersFile not found" instead of the intended "RELEASE_ALLOWED_SIGNERS must contain..." error.

Evidence: publish.yml:49-54 writes file; publish.yml:79-85 reuses allowed_signers="${RUNNER_TEMP}/release-allowed-signers-${GITHUB_RUN_ID}" without test -f or rewrite. The publish job duplicates the same pattern (publish.yml:165 / publish.yml:181-like). scripts/release-packages.mjs:validateSignedTag expects the config to be present.

Checked: both jobs' verify/fetch steps, RUNNER_TEMP persistence across steps is assumed but not verified.

🔵 Issue 4 — Tarball glob in upload-artifact could over-match if inventory check is bypassed

.github/workflows/publish.yml:120 · nit · identified by meta/muse-spark-1.2

Concrete scenario: prepare uploads with path: | .release/package-manifest.json + .release/pegma-mail-*.tgz and include-hidden-files: false. verifyReleaseDirectory enforces exactly one pegma-mail-*.tgz at pack time, but a later step in the same job (or a compromised pnpm test with write access to .release) could drop a second matching tarball between verifyReleaseDirectory and upload-artifact. The glob would then upload both, and the final publish job's entries.length !== 2 check would reject the release, causing a hard-to-diagnose artifact mismatch rather than failing fast at upload.

Evidence: publish.yml:120-125 upload path; scripts/release-packages.mjs:859-895 verifyReleaseDirectory enforces single tgz; publish.yml:209-212 final validation checks entries.length !==2. No check between pack and upload other than the one inside prepareRelease.

Checked: actions/upload-artifact@​v5 glob handling, tests/release-packages.test.ts:1324 only checks that workflow contains the two path lines, not that it pins a single file.

🔵 Issue 5 — resolveNpmCli candidate includes non-existent bin path on hosted toolcache

scripts/release-packages.mjs:128 · nit · identified by meta/muse-spark-1.2

Concrete scenario: resolveNpmCli() pushes join(dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js") as a candidate. On setup-node runners process.execPath is /opt/hostedtoolcache/node/24.18.0/x64/bin/node, so the candidate becomes /opt/hostedtoolcache/node/24.18.0/x64/bin/node_modules/npm/bin/npm-cli.js which never exists. Resolution falls through to which lookup; if which is missing or returns a shell wrapper, the function would incorrectly pick a non-JS wrapper and node <wrapper> --version would fail, breaking prepareBootstrap isolation tests that set npm_execpath to a pnpm shim.

Evidence: scripts/release-packages.mjs:119-145 candidate construction; fallback which + realpathSync handles the hosted-toolcache layout correctly, but the dead candidate adds noise and could mask a which failure in minimal containers.

Checked: tests/release-packages.test.ts:1036 reviewedNpmExecPath logic, runner layout from publish.yml:91-93 node-version: 24.18.0.

🔴 Issue 6 — Publish path lost the retry-safe registry decision and post-publish integrity verification

.github/workflows/publish.yml:293 · bug · identified by z-ai/glm-5.3-flash

Re-running a failed publish now fails hard instead of skipping: if npm publish reaches the registry but the job dies afterwards (runner crash, network drop, timeout), the version exists on npm, and a rerun of the publish job hits EPUBLISHCONFLICT and goes red, where the previous flow reported skip and succeeded because publishPreparedRelease queried dist.integrity first and only published when the version was absent.

The old publish step ran npm run release:publish -> publishPreparedRelease (scripts/release-packages.mjs:1219), which (a) called queryRegistryIntegrity + decidePublication before publishing (absent -> publish, byte-identical -> skip, different bytes -> hard error) and (b) re-queried the registry after publishing and failed with "registry did not expose the exact prepared tarball integrity" if the registry did not serve the prepared bytes. The new inline node heredoc in .github/workflows/publish.yml:197 validates the manifest and digests but goes straight to npm publish with no registry query before or after, so both the retry-safety interlock and the final registry-side integrity confirmation are gone. docs/RELEASING.md § "Registry safety" still advertises the absent/identical/different decision semantics for release publishing, which the automated path no longer implements.

publishPreparedRelease (still exported and tested) is now unreferenced by the workflow, so the tested library publish path and the actually-executed inline script have already drifted. I checked tests/release-packages.test.ts: the workflow string assertions (expect(publish).toContain("node <<'NODE'") etc.) replaced the npm run release:publish assertion and nothing pins the registry decision in the publish job.

🟠 Issue 7 — Publish job relies on the runner-bundled npm instead of the reviewed npm 11.18.0

.github/workflows/publish.yml:260 · risk · identified by z-ai/glm-5.3-flash

The publish step can fail at the very end because the npm that performs npm publish is whatever setup-node's node 24.18.0 bundles, not a pinned version. The prepare job has a dedicated "Use the reviewed npm release" step (npm install --global npm@​11.18.0, publish.yml:96), but the publish job installs nothing; the inline script resolves npm via which npm (publish.yml:260) and only enforces a floor of 11.5.1.

Concrete failure: if the npm bundled with the selected node distribution (or a future runner/node bump) is older than 11.5.1, trusted publishing is unavailable and the job fails with "npm 11.5.1 or newer is required" after prepare has already succeeded and uploaded the artifact — a wasted full release cycle with no version pin to fix. Even when the floor passes, the publisher runs a different npm than the reviewed/pinned one used everywhere else in the release pipeline; requireTrustedPublishingNpm in publishPreparedRelease shows the intended pin is the reviewed 11.18.0.

I checked the workflow for any npm-install step in the publish job (none) and the tests: "installs the reviewed npm before every CI matrix gate" only covers ci.yml, not publish.yml.

🟠 Issue 8 — resolveNpmCli prefers the node distribution's bundled npm over the reviewed PATH npm

scripts/release-packages.mjs:128 · risk · identified by z-ai/glm-5.3-flash

On Windows (and any setup where npm's global prefix differs from the node installation directory), the "reviewed npm" install is silently bypassed and the release tooling runs an unreviewed bundled npm. resolveNpmCli (scripts/release-packages.mjs:119) tries <node-dir>/node_modules/npm/bin/npm-cli.js and <node-dir>/../lib/node_modules/npm/bin/npm-cli.js before consulting which npm, and returns the first existing candidate.

Concrete failure: on Windows, node ships npm inside the node directory, but npm install --global npm@​11.18.0 installs to %APPDATA%\npm\node_modules\npm — the which npm candidate that would resolve to the reviewed 11.18.0 is only appended after the node-dir candidates, so release:pack/bootstrap:pack npm operations (build, pack, registry views) use the node-bundled npm regardless of the documented "install the reviewed npm" step. The same applies on Linux if npm_config_prefix or a version manager routes global installs away from the node directory. Pre-change behavior used which npm (the reviewed install) whenever npm_execpath was pnpm. The GitHub prepare job happens to still get 11.18.0 only because setup-node's global prefix coincides with the node tool-cache directory, so the global install overwrites the bundled npm in place — a fragile coincidence the code does not enforce.

I checked the workflow (npm install --global npm@​11.18.0 runs with the bundled npm and no prefix pin) and the test helper reviewedNpmExecPath (tests/release-packages.test.ts:74), which mirrors the same bundled-first preference, so no test catches the divergence.

🟠 Issue 9 — Release verification requires unauthenticated HTTPS fetch of the repository

.github/workflows/publish.yml:27 · risk · identified by z-ai/glm-5.3-flash

If the repository is private (or later becomes private, or is mirrored to a host where anonymous HTTPS clone is disabled), every release fails in the new pre-checkout verification step. Both jobs fetch through a freshly git init --bare scratch repository with no credentials (git -C "${scratch}" fetch --no-tags --force origin refs/heads/main:... "+refs/tags/${RELEASE_TAG}:..."), and the prepare job's post-checkout fetch (publish.yml:83) also runs unauthenticated because actions/checkout now runs with persist-credentials: false.

The old flow used actions/checkout with default persisted credentials, so its follow-up git fetch origin main worked against private repositories. The new design only works when anonymous read access to the repository is available; for this public npm-package repo that holds today, but the failure mode is silent until the first private-repo or restricted-network release, where "Verify the release ref" fails with a git authentication error before any actionable message.

I checked both Verify the release ref steps and the Fetch verified release refs step: no credential source (no token header, no persist-credentials) is configured for any of the three fetches.

🟠 Issue 10 — Inline publish validator is a second, execution-untested copy of verifyPreparedManifest

.github/workflows/publish.yml:197 · risk · identified by z-ai/glm-5.3-flash

A semantic bug in the publish job's inline Node script would ship unnoticed: the ~100-line validator embedded in publish.yml re-implements verifyPreparedManifest (exact key sets, identity fields, digest recomputation, inventory) but is only covered by string assertions in tests, never executed. Existing manifest-verification tests (rejects a malformed prepared package record cleanly, rejects 0.0.x manifest tampering..., tampered-tarball tests) exercise the library function, not the heredoc; the workflow tests only assert toContain('createHash("sha256")'), toContain("--provenance"), etc.

Concrete failure: editing the inline record.files.length !== 7 count, the expectedFiles array, the digest comparison, or the path.dirname(tarball) !== releaseDirectory guard passes the whole suite (CI=1 pnpm test) because nothing parses or runs the heredoc JavaScript; the bug then surfaces only during a real release, either failing a legitimate release or, worse, letting a mangled manifest through if the edit weakens a check.

I checked tests/release-packages.test.ts for any test that executes the heredoc content (none — only readFileSync + substring/regex assertions) and confirmed the duplication: exactKeys/digest/inventory logic mirrors hasExactKeys/hashTarball/validPreparedFiles in scripts/release-packages.mjs.

🔵 Issue 11 — Workflow and inline version regexes accept non-canonical versions the packer rejects

.github/workflows/publish.yml:35 · nit · identified by z-ai/glm-5.3-flash

A tag like v1.02.3 passes the workflow gate and the inline publisher's version regex but is rejected by the packer, wasting a full prepare-job run (checkout, install, format, types, tests) on a tag that can never release. The workflow regex ^v(0\.[1-9][0-9]*|[1-9][0-9]*\.[0-9]+)\.[0-9]+$ and the inline script's record.version regex both allow a leading zero in the minor for major ≥ 1 ([1-9][0-9]*\.[0-9]+ matches 1.02), while validateReleaseTag in scripts/release-packages.mjs uses /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/ and rejects v1.02.3.

The failure is fail-closed (release:pack stops at the metadata gate), but the three gates disagree: the workflow pre-check blesses tags the enforcing script rejects, and the publish-side regex would accept a manifest version (1.02.3) the packer can never produce. The three patterns should be one canonical semver shape.

I checked both regex occurrences in publish.yml (prepare/publish tag check and the inline record.version check) against validateReleaseTag and STABLE_SEMVER in the script.

🔵 Issue 12 — Stripping *_proxy and NODE_EXTRA_CA_CERTS breaks releases on proxy-only networks with no override

scripts/release-packages.mjs:180 · nit · identified by z-ai/glm-5.3-flash

On a machine where registry.npmjs.org is reachable only through a mandatory egress proxy, release tooling now hard-fails: isolatedNpmEnvironment (scripts/release-packages.mjs:165) drops HTTP_PROXY, HTTPS_PROXY, NO_PROXY, NODE_EXTRA_CA_CERTS, and NODE_OPTIONS from every spawned npm/pnpm operation (pnpm audit --prod, npm view, the smoke-test npm install, the publish), and the inline publish script applies the same blocklist to the npm publish child.

Concrete failure: a contributor following docs/RELEASING.md behind a corporate proxy gets ENOTFOUND/ECONNREFUSED/TLS errors from pnpm run release:pack even though plain npm view @​pegma/mail works in their shell, and there is no opt-in to honor a reviewed proxy — the environment variables are unconditionally discarded. The hardening is defensible (a hostile proxy cannot intercept registry traffic, and the hostile-registry test pins this), but the cost is a network configuration that previously worked and now cannot be expressed.

I checked both blocklists (script and workflow heredoc) and smokeTestTarball, and confirmed no allowlist entry or flag re-enables proxy support.

🔵 Issue 13 — RELEASING.md hides that the shipped dist comes from npm pack's prepack rebuild, not the explicit build

docs/RELEASING.md:168 · nit · identified by z-ai/glm-5.3-flash

A reader auditing the "rebuild package output cleanly" guarantee from the doc gets the wrong mental model of which build produces the shipped tarball. docs/RELEASING.md says "The packer removes prior build output and TypeScript incremental state before a fresh build", but prepareRelease also calls cleanPackageBuildOutputs a second time after that build and before npm pack (scripts/release-packages.mjs:962-968), so the explicit tsc -b output is deleted and the tarball contents come solely from the prepack script (tsc -p tsconfig.json) that npm pack runs itself.

The stated sentence is true but incomplete in a way that matters for security review: the double-clean exists precisely so the packed dist/ is regenerated inside the pack step under the isolated npm environment, and an auditor verifying "packs exactly what it builds" needs to know that. As written, the doc suggests the built output flows into the tarball.

I checked prepareRelease, packages/mail/package.json ("prepack": "tsc -p tsconfig.json"), and the new stale-output test, which confirms the deletion/rebuild ordering.

🔵 Issue 14 — securityscan.md's workflow claims are now stale for publish.yml

docs/securityscan.md:22 · nit · identified by z-ai/glm-5.3-flash

docs/securityscan.md still records, as a reviewed-OK fact, that the workflows have "no script injection from event context (release tag used only as a ref string and in artifact names, not interpolated into shell)". The new publish.yml interpolates RELEASE_TAG into shell fetch refspecs ("+refs/tags/${RELEASE_TAG}:refs/tags/${RELEASE_TAG}") and runs a large workflow-owned Node heredoc, so that claim no longer describes the file (the tag is regex-gated before use, so this is a documentation accuracy issue, not an open injection path).

Since the doc is the repository's running security record for exactly these files, the next scan or reviewer inherits an outdated attestation; the entry should be refreshed to describe the new env-var-interpolation pattern, its regex gate, and the inline publish validator.

I checked docs/securityscan.md:20-28 against the current publish.yml and confirmed the changed interpolation sites.

Workflow run

Comment thread scripts/release-packages.mjs Resolved
Comment thread .github/workflows/publish.yml Resolved
Comment thread .github/workflows/publish.yml Resolved
Comment thread scripts/release-packages.mjs Resolved
Comment thread .github/workflows/publish.yml Resolved
RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
RELEASE_REPOSITORY: https://github.com/${{ github.repository }}.git
RELEASE_TAG: ${{ github.event.release.tag_name }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 Release verification requires unauthenticated HTTPS fetch of the repository (risk)

If the repository is private (or later becomes private, or is mirrored to a host where anonymous HTTPS clone is disabled), every release fails in the new pre-checkout verification step. Both jobs fetch through a freshly git init --bare scratch repository with no credentials (git -C "${scratch}" fetch --no-tags --force origin refs/heads/main:... "+refs/tags/${RELEASE_TAG}:..."), and the prepare job's post-checkout fetch (publish.yml:83) also runs unauthenticated because actions/checkout now runs with persist-credentials: false.

The old flow used actions/checkout with default persisted credentials, so its follow-up git fetch origin main worked against private repositories. The new design only works when anonymous read access to the repository is available; for this public npm-package repo that holds today, but the failure mode is silent until the first private-repo or restricted-network release, where "Verify the release ref" fails with a git authentication error before any actionable message.

I checked both Verify the release ref steps and the Fetch verified release refs step: no credential source (no token header, no persist-credentials) is configured for any of the three fetches.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This does not apply to this repository: repository metadata is isPrivate: false, and anonymous fetch is the deliberate pre-checkout verification path. Adding checkout credentials before ref verification would conflict with the requested ordering. Leaving this open for Nathan.

Comment thread .github/workflows/publish.yml Resolved
Comment thread .github/workflows/publish.yml Resolved
normalized === "npm_command" ||
normalized === "node_options" ||
normalized === "node_extra_ca_certs" ||
normalized.endsWith("_proxy")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 *Stripping _proxy and NODE_EXTRA_CA_CERTS breaks releases on proxy-only networks with no override (nit)

On a machine where registry.npmjs.org is reachable only through a mandatory egress proxy, release tooling now hard-fails: isolatedNpmEnvironment (scripts/release-packages.mjs:165) drops HTTP_PROXY, HTTPS_PROXY, NO_PROXY, NODE_EXTRA_CA_CERTS, and NODE_OPTIONS from every spawned npm/pnpm operation (pnpm audit --prod, npm view, the smoke-test npm install, the publish), and the inline publish script applies the same blocklist to the npm publish child.

Concrete failure: a contributor following docs/RELEASING.md behind a corporate proxy gets ENOTFOUND/ECONNREFUSED/TLS errors from pnpm run release:pack even though plain npm view @​pegma/mail works in their shell, and there is no opt-in to honor a reviewed proxy — the environment variables are unconditionally discarded. The hardening is defensible (a hostile proxy cannot intercept registry traffic, and the hostile-registry test pins this), but the cost is a network configuration that previously worked and now cannot be expressed.

I checked both blocklists (script and workflow heredoc) and smokeTestTarball, and confirmed no allowlist entry or flag re-enables proxy support.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This conflicts with the requested release isolation: inherited proxy variables and custom CA or Node overrides must be stripped before npm runs. Registry and scope routing are pinned to npmjs with empty private configuration files. Leaving this open for Nathan.

Comment thread docs/RELEASING.md Resolved
@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

Fixed in 2166ea2c7c5aaf2e93fa8643728171e8707b24c5: CI now installs the reviewed npm release with lifecycle scripts disabled and the public registry pinned; docs/securityscan.md now records the env-gated refspec and executable workflow-validator coverage.

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: d3c3958bbf6694db409ce5ec831ccd7c8ec8cf63
Judge: openai/gpt-5.6-luna
Cost: $0.1872 (lanes $0.1866 + judge $0.0007)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 38.3s, 94550+4856 tokens (226 cached), 2 tool round(s), via Meta, $0.14)
  • z-ai/glm-5.3-flash: ok (1 finding(s), 343.7s, 553743+47238 tokens (477440 cached), 11 tool round(s), via Friendli, $0.0480)

Round 2 resolution

  • ✅ r1-6 fixed correctly — Publish path lost the retry-safe registry decision and post-publish integrity verification: Publish job now implements retry-safe decision and post-publish verification: .github/workflows/publish.yml:307-347 adds queryRegistryIntegrity() via npm view ... dist.integrity --json, returns null on E404, skips publish when existingIntegrity === record.integrity, fails on mismatch, publishes otherwise and re-queries to assert publishedIntegrity === record.integrity. Mirrors `scripts/r…
  • ✅ r1-2 fixed correctly — Dead intermediate build after second clean in prepareRelease: scripts/release-packages.mjs:962-973 now does single await cleanPackageBuildOutputs(packageDirectory), then runPublicRegistryNpm(["--prefix", packageDirectory, "run", "build"]), then npm pack --ignore-scripts --json --pack-destination. Second clean removed, prepack disabled, so artifact is the explicit build output. Verified by tests/release-packages.test.ts:1385 expecting one clean, b…
  • ✅ r1-7 fixed correctly — Publish job relies on the runner-bundled npm instead of the reviewed npm 11.18.0: Publish job now has publish.yml:206 step npm install --global npm@​11.18.0 --ignore-scripts --registry https://registry.npmjs.org/ identical to prepare job, and validator enforces exact version publish.yml:310 trim() !== "11.18.0" instead of floor 11.5.1. Tests assert presence of that install line.
  • ⚠️ r1-8 fixed incorrectly — resolveNpmCli prefers the node distribution's bundled npm over the reviewed PATH npm: The reorder does consult PATH first, and on POSIX resolveNpmCli now returns realpathSync of the which npm hit, which after the global install is the reviewed npm — that is what the new test asserts on Linux. On Windows, however, the reviewed npm is still unreachable: where.exe npm.cmd lists the node installation directory first (it precedes %APPDATA%\npm in PATH, and setup-node prepends …
  • 🤝 r1-9 disputed — Release verification requires unauthenticated HTTPS fetch of the repository: Fetch remains unauthenticated (git -C "${scratch}" fetch --no-tags --force origin ... with persist-credentials: false and RELEASE_REPOSITORY=https://github.com/${{github.repository}}.git), but repo is public (git+https://github.com/pegma-dev/mail.git, docs/RELEASING.md describes disposable bare-repo verification before checkout). Anonymous fetch is intentional hardening to avoid exposing…
  • ✅ r1-10 fixed correctly — Inline publish validator is a second, execution-untested copy of verifyPreparedManifest: Workflow validator is now execution-tested. publish.yml:274 adds --validate-only early exit; tests/release-packages.test.ts:1377 extracts validator via workflowPublishValidator(), writes to temp file, runs it with RELEASE_COMMIT/RELEASE_TAG, asserts success, then asserts failure on extra .extra file and on tampered sha256, proving the ~100-line heredoc is executed, not just string-as…
  • 8 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 2 (0 bug-severity).

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit d3c3958 and does not cover the newest push.

Findings

🟠 Issue 1 — Post-publish integrity re-check can turn a successful publish red on registry read lag or transient errors

.github/workflows/publish.yml:347 · risk · identified by z-ai/glm-5.3-flash

npm publish runs with stdio: "inherit" and, once it exits 0, the new code immediately re-queries the registry (queryRegistryIntegrity(), publish.yml:346) and fails the job unless the packument reports exactly the prepared integrity. Two failure shapes can occur after the publish side effect has already completed: a registry E404 while the packument has not propagated returns null (line 331), and any non-404 failure (network blip, 5xx) throws with "npm registry lookup exited ...". In both cases the publish job goes red even though the tarball is on npm.

The damage is contained: the pre-publish decision at lines 333-336 is retry-safe, so a rerun sees existingIntegrity === record.integrity, prints "already published", and goes green. So this costs a false red on a publish run (and operator confusion), not a mis-publish or a stuck release.

What I checked: the pre-check itself is fail-closed and matches the script-side decidePublication semantics (scripts/release-packages.mjs:1053), and --prefer-online plus npm's CDN purge on publish shrink the lag window. Proof gap: I cannot exercise registry behavior from this review, so I am flagging the post-publish re-query as a risk rather than a bug; if the team wants determinism here, the dist.integrity from the publish response, or a short retry/backoff on the re-query, would avoid failing after the irreversible step.

Workflow run

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

Fixed in 9ed7193b157141fd60a7440241a309b1217fff30: post-publication registry confirmation now uses bounded retries at 0, 1, 2, 4, and 8 seconds before reporting a read failure.

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: partial
Scope: latest-commit (commit-range)
Mode: verify
Commit: 2166ea2c7c5aaf2e93fa8643728171e8707b24c5
Judge: openai/gpt-5.6-luna
Cost: $0.1847 (lanes $0.1828 + judge $0.0019)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 33.3s, 99271+3581 tokens (226 cached), 2 tool round(s), via Meta, $0.14)
  • z-ai/glm-5.3-flash: ok (3 finding(s), 253.6s, 409713+42051 tokens (322560 cached), 10 tool round(s), via PrimeIntellect, $0.0438)

Round 2 resolution

  • ✅ r1-6 fixed correctly — Publish path lost the retry-safe registry decision and post-publish integrity verification: publish.yml now does pre-publish queryRegistryIntegrity via npm view ... dist.integrity --json with --registry https://registry.npmjs.org/, skips when existingIntegrity === record.integrity, fails on different integrity, publishes otherwise, then re-queries and requires publishedIntegrity === record.integrity — restoring the retry-safe skip and post-publish verification lost in the earli…
  • ✅ r1-2 fixed correctly — Dead intermediate build after second clean in prepareRelease: scripts/release-packages.mjs:prepareRelease now calls cleanPackageBuildOutputs once, then runPublicRegistryNpm(["--prefix", packageDirectory, "run", "build"]), then npm pack --ignore-scripts — removed the second clean that made the build dead code; tests/release-packages.test.ts asserts single clean, build before pack, and --ignore-scripts.
  • ✅ r1-7 fixed correctly — Publish job relies on the runner-bundled npm instead of the reviewed npm 11.18.0: publish job now has Use the reviewed npm release step npm install --global npm@​11.18.0 --ignore-scripts --registry https://registry.npmjs.org/ (and CI job updated similarly) and the inline validator enforces String(npmVersion.stdout).trim() !== "11.18.0" fail, matching the reviewed version instead of floor-checking 11.5.1 on runner-bundled npm.
  • ⚠️ r1-8 fixed incorrectly — resolveNpmCli prefers the node distribution's bundled npm over the reviewed PATH npm: The reorder fixes POSIX setups: which npm hits are realpath'd first (following wrapper symlinks to wherever the global npm actually lives) and node-dir candidates are now the last fallback. But the finding's named Windows case persists: on win32 each where.exe npm.cmd hit is mapped to dirname(hit)/node_modules/npm/bin/npm-cli.js, and under the standard Node-installer PATH ordering the first …
  • 🤝 r1-9 disputed — Release verification requires unauthenticated HTTPS fetch of the repository: Repository is public (isPrivate: false) and anonymous git init --bare fetch is the intentional pre-checkout verification path to validate tag/signature before checkout. Adding credentials before verification would conflict with requested ordering. Private-mirror failure is speculative for this public repo; no code change warranted — accepted as intentional tradeoff per fixing-agent rebuttal.
  • ✅ r1-10 fixed correctly — Inline publish validator is a second, execution-untested copy of verifyPreparedManifest: tests/release-packages.test.ts now extracts the heredoc via workflowPublishValidator, writes it to a temp file and executes it (--validate-only) against valid, extra-entry, and changed-digest fixtures, so the inline publish.yml validator is execution-tested, not just string-asserted.
  • 8 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 4 (0 bug-severity).

Warning

The PR head advanced after this review's diff was collected. This review is pinned to commit 2166ea2 and does not cover the newest push.

Findings

🟠 Issue 1 — Reviewed npm is still shadowed by the node-bundled npm on Windows despite the resolution reorder

scripts/release-packages.mjs:139 · risk · identified by z-ai/glm-5.3-flash

On a Windows development machine following docs/RELEASING.md:56 (npm install --global npm@​11.18.0), the release tooling still runs the node-bundled npm instead of the reviewed one — the silent bypass finding r1-8 described.

resolveNpmCli now consults where.exe first, but on win32 it maps every hit to join(dirname(executable), "node_modules", "npm", "bin", "npm-cli.js") and candidates.find(existsSync) keeps the first existing entry. Under the standard Node-installer layout, the first PATH hit is C:\Program Files\nodejs\npm.cmd (system PATH precedes user PATH), whose sibling node_modules\npm is the bundled npm, while npm's documented default Windows prefix is %AppData%\npm — so the reviewed install at %AppData%\npm\node_modules\npm\bin\npm-cli.js is a later candidate that never wins.

What I checked: the new test (tests/release-packages.test.ts:455) cannot catch this because its reviewedNpmExecPath() helper reproduces the same first-hit sibling mapping on win32, so both sides agree on the wrong path; CI is unaffected because the workflows run on ubuntu-latest. Proof gap: I cannot execute on Windows here; the claim rests on npm's documented default Windows prefix and the standard system-PATH-before-user-PATH ordering, which I could not verify from the repository alone.

🟠 Issue 2 — resolveNpmCli now returns PATH shims (asdf/Volta) verbatim, breaking release commands that previously worked

scripts/release-packages.mjs:136 · risk · identified by z-ai/glm-5.3-flash

On machines where npm on PATH is a launcher shim rather than a symlink to npm-cli.js, release commands now fail where they previously resolved the real CLI.

resolveNpmCli pushes realpathSync(executable) for every which npm hit on POSIX and picks the first existing candidate without checking that the target is actually an npm JS CLI. For asdf the hit is ~/.asdf/shims/npm (a bash script) and for Volta ~/.volta/bin/npm (a native shim), so runNpm (scripts/release-packages.mjs:170) executes node <shim> --version ... and node fails to parse it. Before this change the two node-dir candidates (<nodeDir>/node_modules/npm/..., <nodeDir>/../lib/node_modules/npm/...) were tried first and existed for both managers' official-tarball layouts (~/.asdf/installs/nodejs/<ver>/lib/node_modules/npm/..., ~/.volta/tools/image/node/<ver>/lib/node_modules/npm/...), so resolution succeeded.

This regression was introduced by the reordering done for r1-8 (node-dir candidates moved from first to last). A durable fix would verify that a PATH-derived candidate resolves to the npm CLI JS before trusting it, falling back to the node-dir candidates otherwise. What I checked: the repo's test helper mirrors the same algorithm, so no test detects it; CI is unaffected because setup-node's bin/npm is a symlink. Proof gap: I could not execute on an asdf/Volta machine; the failure mode follows from the shim layouts, which are outside this repository.

🟠 Issue 3 — Inline publish job's npm/registry decision logic remains execution-untested

.github/workflows/publish.yml:314 · risk · identified by z-ai/glm-5.3-flash

A semantic mistake in the publish job's registry-decision code would ship unnoticed, repeating the failure mode r1-10 described for the manifest half — this time on code newly inlined by the r1-6 fix.

The new executable test (tests/release-packages.test.ts:1370) extracts the heredoc and runs it with --validate-only, which early-exits before any npm code runs. Everything after that point — which npm resolution, the exact 11.18.0 gate, queryRegistryIntegrity (E404 → publish, differing bytes → fail), the skip branch, and the post-publish integrity re-verification — is covered only by substring assertions (tests/release-packages.test.ts:1303-1305).

The repository already has the machinery to test this offline: startTestRegistry drives the library publishPreparedRelease/decidePublication against a fake registry, and the inline script resolves npm via which npm, so a stub npm on PATH (printing 11.18.0 for --version, canned view/publish output) would let the same extraction technique drive every branch. What I checked: no test executes the heredoc beyond --validate-only; grep for queryRegistryIntegrity in tests returns only the string assertions. Proof gap: none — the absence of execution coverage is directly visible in the diff and test file.

Workflow run

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 9ed7193b157141fd60a7440241a309b1217fff30
Judge: openai/gpt-5.6-luna
Cost: $0.1979 (lanes $0.1977 + judge $0.0001)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 50.2s, 155185+3313 tokens (59091 cached), 3 tool round(s), via Meta, $0.14)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 312.2s, 830695+43287 tokens (618368 cached), 18 tool round(s), via CoreWeave, $0.0547)

Round 2 resolution

  • ✅ r1-6 fixed correctly — Publish path lost the retry-safe registry decision and post-publish integrity verification: Publish job now implements retry-safe decision: queryRegistryIntegrity before publish, skip when existingIntegrity === record.integrity, fail when different, else publish and retry post-publish verification with bounded delays [0,1000,2000,4000,8000] comparing publishedIntegrity to record.integrity (.github/workflows/publish.yml ~307-376). Matches publishPreparedRelease logic.
  • ✅ r1-2 fixed correctly — Dead intermediate build after second clean in prepareRelease: prepareRelease now cleans once, then builds once via --prefix packageDirectory run build, then packs with --ignore-scripts; second clean removed. Verified in scripts/release-packages.mjs and test 'cleans once, builds once, and packs without lifecycle scripts' asserts single cleanPackageBuildOutputs and ordering and --ignore-scripts.
  • ✅ r1-7 fixed correctly — Publish job relies on the runner-bundled npm instead of the reviewed npm 11.18.0: Publish job now has 'Use the reviewed npm release' step (npm install --global npm@​11.18.0 --ignore-scripts --registry https://registry.npmjs.org/) and inline script requires exact '11.18.0' (String(npmVersion.stdout).trim() !== "11.18.0"), not just >=11.5.1. CI job similarly pinned.
  • ✅ r1-8 fixed correctly — resolveNpmCli prefers the node distribution's bundled npm over the reviewed PATH npm: resolveNpmCli now collects all PATH candidates first (which/where.exe), then appends node-distribution fallback, dedups, filters existsSync, and selects first candidate whose node <cli> --version equals REVIEWED_NPM_VERSION (11.18.0) under isolated env. Windows branch evaluates every PATH npm.cmd candidate via node_modules/npm/bin/npm-cli.js and version check before fallback, so reviewed PATH in…
  • 🤝 r1-9 disputed — Release verification requires unauthenticated HTTPS fetch of the repository: Repository is public (isPrivate: false) and anonymous fetch is intentional pre-checkout verification ordering. Both jobs create bare scratch repo and verify tag signature and main ancestry before checkout; persist-credentials:false keeps later fetches unauthenticated by design. Adding credentials before verification would violate requested ordering. No private-repo failure applies to this repo.
  • ✅ r1-10 fixed correctly — Inline publish validator is a second, execution-untested copy of verifyPreparedManifest: Inline validator is no longer string-only: tests extract exact heredoc via workflowPublishValidator() and execute it with --validate-only against valid, extra-entry (.extra) and changed-digest fixtures, asserting 0/ non-zero exits and error messages. Workflow now supports --validate-only early exit and publishes coverage assertions remain.
  • 8 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY

FlyOverCoderKY commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Follow-up for the review pinned to 2166ea2c7c5a:

  • Fixed in 9ed7193b157141fd60a7440241a309b1217fff30: npm candidates are accepted only when they execute as JavaScript and report exactly 11.18.0, so earlier Windows PATH entries and POSIX launcher shims do not take precedence over the reviewed CLI.
  • Fixed in 604a8f146fb3d0a179851a9121f67423913c38b0: the extracted workflow-owned publisher now executes offline tests for exact-version skip, different-integrity rejection, and publish followed by registry confirmation on both supported runner families.

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: issues
Scope: latest-commit (commit-range)
Mode: verify
Commit: 604a8f146fb3d0a179851a9121f67423913c38b0
Judge: openai/gpt-5.6-luna
Cost: $0.1712 (lanes $0.1703 + judge $0.0009)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 36.6s, 134771+4080 tokens (48324 cached), 4 tool round(s), via Meta, $0.13)
  • z-ai/glm-5.3-flash: ok (1 finding(s), 258.7s, 448653+38250 tokens (326080 cached), 11 tool round(s), via Makora, $0.0377)

Round 3 resolution

  • No prior findings were open.
  • Open findings after this round: 1 (0 bug-severity).

Findings

🔵 Issue 1 — Workflow publisher resolves Windows npm from only the first where.exe result, diverging from the reviewed resolveNpmCli policy

.github/workflows/publish.yml:288 · nit · identified by z-ai/glm-5.3-flash

On a Windows host where the first npm.cmd on PATH is a shim without node_modules/npm/bin/npm-cli.js adjacent (Volta, pnpm, or Scoop shim directories), the workflow's inline validator hard-fails with npm is unavailable even though a valid npm 11.18.0 is installed elsewhere: it takes npmLookup.stdout...[0], derives one npm-cli.js path from it, and fails on !fs.existsSync(npmCli) (.github/workflows/publish.yml:288-292). The same selection is never re-run for later candidates, and the post-selection 11.18.0 gate at line 315 rejects rather than advancing to the next candidate.

The module-level resolver this code mirrors does not have this limitation: resolveNpmCli in scripts/release-packages.mjs:119-153 iterates every where.exe result, appends the process.execPath-derived fallback, probes each candidate with node <cli> --version, and only fails with could not resolve the npm CLI when no candidate reports exactly 11.18.0. The heredoc also lacks the fallback candidate entirely, so the two implementations of the same "reviewed npm" policy can disagree on Windows hosts with shims earlier on PATH.

Reachability is currently nil, which is why this is a nit rather than a bug: the publish job is pinned to runs-on: ubuntu-latest (so the win32 branch never runs in the release path), and the new test executes the workflow-owned registry decision paths prepends its fixture binDirectory to PATH, so on Windows the first where.exe npm.cmd hit is always the fixture with an adjacent fixture npm-cli.js. I checked tests/release-packages.test.ts for assertions pinning the old lookup code (npmLookup, where.exe) and found none, so nothing fails today — this is a latent divergence only, with the proof gap that no supported configuration currently reaches the failure.

Workflow run

Comment thread .github/workflows/publish.yml Resolved

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 189ee129debe99d0bb5875fd23414b22acd1aecc
Judge: openai/gpt-5.6-luna
Cost: $0.0617 (lanes $0.0616 + judge $0.0001)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 17.9s, 41408+2213 tokens (8915 cached), 2 tool round(s), via Meta, $0.0514)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 217.1s, 237361+19794 tokens (179822 cached), 9 tool round(s), via OpenInference, $0.0103)

Round 4 resolution

  • 1 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@github-actions github-actions 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.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 6e678171cae0d045570cf22b5768cd8eb158f87d
Judge: openai/gpt-5.6-luna
Cost: $0.2435 (lanes $0.2434 + judge $0.0001)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 19.7s, 149703+1929 tokens (25480 cached), 7 tool round(s), via Meta, $0.17)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 277.4s, 1515708+56875 tokens (1404160 cached), 28 tool round(s), via DigitalOcean, $0.0761)

Round 5 resolution

  • No prior findings were open.
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY merged commit 89376a3 into main Nov 6, 2026
5 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the claude/harden-release-workflow branch November 6, 2026 21: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