Skip to content

release: enforce non-latest npm dist-tag for prerelease versions (#9302) - #9552

Merged
EffortlessSteven merged 12 commits into
mainfrom
claude/audit-npm-prerelease-dist-tag
Oct 22, 2026
Merged

EffortlessSteven merged 12 commits into
mainfrom
claude/audit-npm-prerelease-dist-tag

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #9302 (T5 trust-audit finding F1, release_control_defect)

Acceptance delta (one sentence): The existing distribution validator (cargo xtask check-release-targets, xtask/src/policy/distribution/npm_launcher.rs) now fails a prerelease npm launcher version without an explicit non-latest publishConfig.tag, and fails any in-tree workflow npm publish / npm dist-tag that does not use exactly one literal non-latest tag.

What changed (head 92eacd0)

  • Manifest rule: PublishConfig.tag plus validate_publish_tag inside validate_launcher (no second validator). A prerelease with no, empty or latest (case-insensitive) tag fails; a stable version with a non-latest tag fails. Prerelease detection ignores SemVer build metadata (1.0.0+build-1 is stable). The committed package.json (stable 0.11.0) is unchanged.
  • Workflow rule: validate_workflow_npm_tags uses a shell-aware tokenizer. It joins \ continuations, strips quotes, treats # as a comment only at a word start outside quotes, splits commands on ; & | ( ) even when glued, and re-tokenizes a quoted npm ... word. It finds publish / dist-tag(s) anywhere after npm, skipping the values of value-taking flags (-w, --workspace, --otp, ...). It requires exactly one literal non-latest --tag (rejects $VAR, ${{ }}, backticks, $(...), repeated or mixed options), exempts --dry-run, and rejects npm dist-tag add/set <pkg> with no tag (defaults to latest).
  • scan_workflow_npm_tags fails on unreadable workflow directories or files, and on a missing workflows directory whose parent exists (wrong working directory).
  • bump-version adds "tag": "next" for a prerelease target and removes it for a stable target.
  • RIPR-SPEC-0212 acceptance examples 9-11, test mapping and traceability; docs note; changelog fragment.

Out of scope (stated in the spec)

pnpm / yarn publish, NPM_CONFIG_TAG, composite or reusable actions, and the real publish workflow (source ripr repo, ripr#1781/#1784). Generated per-platform packages are not in-tree.

Proof

  • cargo test -p xtask --bin xtask -- policy::distribution npm_launcher_version_tests: 83 passed, 0 failed. Negative experiments cover prerelease with no tag / latest / empty, stable with next, multiline, chained, glued-separator, global-flag, interpolated, repeated-tag, dist-tag-without-tag and unreadable-workflow cases, each paired with positive controls (prerelease + next, npm publish --tag next, --dry-run, comments, npm run publish, dist-tag ls).
  • cargo clippy -p xtask --all-targets -- -D warnings: clean.
  • cargo xtask precommit on the final commit: all policy gates through check-local-context and check-covered-by and the rest of the policy list passed, but the run ended with an instrument failure (covered_by enumeration timed out at 300s and was SIGKILLed on the contended shared build host), not a source or policy failure. Earlier attempts were also hit by disk-full and OOM kills. Hosted CI on the exact head remains the outstanding proof; final-merge review is incomplete until then.
  • bump-version tests exercise replace_npm_launcher_versions plus the validator (the two steps prepare_release_update runs), not prepare_release_update itself.
  • No registry state touched; moving latest stays held for Steven.

🤖 Generated with Claude Code

https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 22, 2026 06:52
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 103 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: d9263a52-25a7-44c4-9282-e3e8614c8b29
📥 Commits

Reviewing files that changed from the base of the PR and between 969b0b8 and 12b402a.

📒 Files selected for processing: 8
  • .ripr/traceability.toml
  • changelog.d/9302-npm-prerelease-dist-tag.md
  • docs/PYPI_NPM_DISTRIBUTION.md
  • docs/specs/RIPR-SPEC-0212-npm-native-launcher-boundary.md
  • xtask/src/policy/distribution/mod.rs
  • xtask/src/policy/distribution/npm_launcher.rs
  • xtask/src/policy/distribution/tests.rs
  • xtask/src/version.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 5 potential issues.

Devin Review

Comment thread xtask/src/policy/distribution/mod.rs Resolved

Copy link
Copy Markdown
Member Author

Review of record, head 92eacd0

Angles: independent read-only delta review (tokenizer, value-flag handling, dist-tag rules, parent-exists fail-closed, test discrimination, spec) of 60c5d5c..92eacd0; five Devin threads answered and resolved. Nothing was built by the reviewer.

Findings: no blockers. All 10 earlier bypasses are closed and covered by tests; no false positives on the current .github/workflows tree; the prerelease/build-metadata handling is correct. Non-blocking fail-open tokenizer forms (quoted bash -c, backticks, escapes, npm exec, npm.cmd, abbreviated flags, unlisted value flags, 2>&1 splitting) are tracked in #9601 with acceptance criteria.

CI: windows-advisory-subset is red on this head; it is the advisory selector-quoting set tracked in #9521 and is not a required check. Merging when Ripr Rust Small Result is green on this head.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Review of record update, head 3fbbca7

Two further independent read-only delta reviews after 92eacd0:

  • 441b2f9 (script-text-only scan, answering the Graphite false-positive finding): found a fail-open where a block scalar on a - key: line swallowed a sibling run: npm publish.
  • 3fbbca7 (block scalars now end at the key column): no blockers. The sibling run: after - if: >-, - name: |, - env: | and - with: | is scanned; - run: | bodies still scanned and end at the next sibling key; nested lists, tabs and CRLF fail closed. workflow_block_scalar_ends_at_key_column_for_list_items fails on 441b2f9.

Local proof: 85 xtask distribution tests pass; clippy -D warnings clean. Remaining tokenizer limits are tracked in #9601. The PR body above still describes 92eacd0; the acceptance delta is unchanged.

CI: the earlier required-check run was affected by known_false ledger drift on main (#9588); I will re-apply merge-ready once that lands so the check runs on the exact head.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed findings

  • The scanner silently ignores workflow files whose extensions are not yml or yaml, despite the workflow directory scan being responsible for enforcing npm publish safety.

Verification questions

  • Confirm heavy witnesses (build, cargo-check, cargo-clippy, cargo-test as base) and ripr sensor failed; precommit ran but ended on covered_by SIGKILL, so no fresh cargo xtask check-release-targets or cargo xtask check_distribution_contract evidence is recorded for the post-3fbbca7e head. Cross-host reproducibility of the new scan is unverified.
  • Confirm scan_workflow_npm_tags is invoked only from check_distribution_contract, so cargo xtask check-release-targets does not gate workflow changes independently of the contract check.
  • Confirm validate_publish_tag accepts the literal string latest for stable, but a path with two publishConfig siblings could regress to wrong order after set_npm_launcher_publish_tag removes the comma.

Refuted

  • The manifest and workflow enforcement should also be applied to adjacent package-manager publish paths such as pnpm or yarn.; refuted because: This PR's governing spec explicitly scopes those tools out; broadening now would require separate acceptance criteria and likely parser behavior, so it is parked rather than silently included.
  • The recursive shell tokenizer or workflow path scan could cause aliasing or dangling-reference behavior at the native seam.; refuted because: Tokens and paths are owned values; shell_tokens returns a fresh Vec and recursive calls consume immutable borrowed text only for the call duration. No unsafe code or lifetime-erasing pointer is introduced.
  • This PR modifies worker/async JS memory-crossing behavior.; refuted because: The diff changes distribution-policy validation, YAML workflow scanning, release-version maintenance, documentation, and tests; it does not modify worker, async, GC, detach, transfer, native-handle, or JavaScript ownership code.
  • The version-bump tests do not exercise the production release path.; refuted because: The PR thread explicitly acknowledges prepare_release_update is not directly tested, but the tests exercise both steps it performs and the seeded review treats that limitation as non-blocking.
  • The scanner must recurse into nested workflow directories.; refuted because: The implementation intentionally scans only direct workflow entries, and the acceptance text describes an in-tree workflow scan without a recursive-directory requirement.

Evidence gaps

  • The scheduled cargo-test receipt remains the outstanding execution proof for the exact test target.
  • Executable proof is incomplete because RIPR failed and cargo-test is scheduled late; local review claims 85 tests and clean clippy are not current sensor receipts.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Reply to automated review 5612517648:

  • "Scanner ignores non-yml/yaml workflow files": GitHub Actions only loads .yml and .yaml files from .github/workflows, so any other extension cannot run a publish. The scan covers exactly the files Actions can execute; no change.
  • scan_workflow_npm_tags is called from check_distribution_contract, which check-release-targets runs; that is the intended single owner (no second validator).
  • set_npm_launcher_publish_tag comma handling is covered by the bump-version tests for adding and removing "tag" on both prerelease and stable targets.
  • Exact-head executable proof is the hosted required run; the local precommit covered_by timeout is recorded in the PR body as an instrument gap.

Generated by Claude Code

Copy link
Copy Markdown
Member Author

Independent bounded source review at12b402a156be3abc16d6c8754923a8ec4e1bcd5b found no blocker in the YAML key-column and comment-backslash repairs. Keep the latest reported86 focused tests tied to their actual tested commit; earlier85-test receipts do not qualify this successor by themselves.

Next existing-owner action: reconcile current-head integration and applicable required admission after the landed #9588 repair, preserving validation already running rather than dispatching duplicates. CI39763157194 was skipped and ub-review39763157032 was running at observation; Source of Truth/wheel passes are bounded, not end-to-end publishing enforcement.

Retain #9601's broader tokenizer forms and the external-workflow/generated-package boundary explicitly. The comment-continuation fix must not be described as all shell/npm publishing syntax enforced. This is ordinary code-review coordination only; no registry, release or deployment action is requested.

Copy link
Copy Markdown
Member Author

Review of record update, head 12b402a.

Delta since the earlier reviewed head covers 3fbbca7 (block scalar ends at the key column for list items), a0577e2 (renamed a test-string job key so check-local-context no longer reads it as a Windows path) and 12b402a (a comment line ending in a backslash no longer hides the next command).

  • Angles: tokenizer correctness and fail-open forms; tests and regressions (three new negative tests, 86 distribution tests passing locally); spec/contract (RIPR-SPEC-0212 examples 9-11, traceability).
  • Findings: no blocker. The independent bounded source review at 12b402a (comment above) found none. Remaining tokenizer limits are tracked in policy(npm): publish/dist-tag scanner tokenizer still fails open on quoted bash -c, backticks, escapes, exec #9601.
  • Not established: full cargo xtask precommit on this head (host contention); hosted Ripr Rust Small Result is the outstanding proof. merge-ready re-applied on this head; I merge only if that check is green on 12b402a.

Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 2768de5 into main Oct 22, 2026
51 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/audit-npm-prerelease-dist-tag branch October 22, 2026 11:37

Copy link
Copy Markdown
Member Author

Merged as 2768de5 (squash, expected head 12b402a). Ripr Rust Small Result green on that head (run 39766089454). Remaining tokenizer limits: #9601. Registry state untouched; moving npm latest stays held for Steven.


Generated by Claude Code

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants