Skip to content

fix(npm): preserve ZIP wire identity during package admission - #1842

Merged
EffortlessSteven merged 1 commit into
mainfrom
fix/npm-zip-wire-identity-20261009
Oct 9, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
fix/npm-zip-wire-identity-20261009

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Merged through normal protection as 9d3d2750d2e6181f629a360a51cdf027fb8eeb1d at 2026-10-09 20:39:37 UTC. Merge/main tree 8852e119bd94e49c3b0e1b0c21ccfde0b7f2c3c7 equals the reviewed and routed-tested tree. Final exact-head review: REVIEW_READY; all 22 routed commands and 8,024/8,024 tests passed. This source fix does not complete final-candidate qualification.

ZIP admission validated Python's normalized member name, allowing backslashes on Windows and NUL suffixes on both hosts to alias canonical artifact/wheel members. Require each original wire name to equal the accepted name before reading payload bytes, and preserve literal malformed names and executable modes in the fixtures.

Work item: bounded source-owned package qualification under #1606/#1578, with the existing #1781/#1784 contract. Acceptance: both actual ZIP validators refuse normalized wire aliases while the canonical byte-admission suite still passes. RIPR-SPEC-0180 records the invariant. Only three files change; no package names, pinned toolchains, workflow/permission/security-runner settings, version or publication action changes.

Exact candidate: b01e02fab229fbf5d7c816207cb1d85828bea5ef, tree 8852e119bd94e49c3b0e1b0c21ccfde0b7f2c3c7, parent source main ab614355d59d6c558b6756c88727bf507538ac41. Carrier #1818, producer/raw #1627, and archive-route #1827 remain their existing owners. Carrier's current version-banner test is disjoint from this patch; its current ZIP validator remains identical to main.

Observed native Windows/Python 3.14.6:

  • Baseline: python -m unittest discover -s .github/scripts -p test_npm_package.py — 28 selected, 23 executed, 5 existing Unix/transport skips, one backslash-control failure.
  • Strengthened controls against old validators — 30 selected, 7 failing subcases, 5 existing skips. Raw malformed names and native executable mode were checked so another error cannot substitute for the targeted refusal.
  • Exact committed file contents fetched back and matched local files; repaired suite — 30 selected, 25 executed, 5 existing skips, 0 failures. Both Unix and Windows reader normalization variants execute in the new controls.
  • Existing regular ZIP, wheel/RECORD/native identity and full mocked admission controls passed. These local observations are synthetic archive/admission controls; local tests execute no candidate binary or package install.

Observed automatic hosted proof at the same published head:

  • npm qualification 37983142136, attempt 1 completed success. Linux wheel build/audit, clean pip and uv install/use/reinstall/uninstall, packaging, both npm consumer jobs and publisher controls all executed successfully.
  • Package admission job: 30 selected / 29 executed / 1 staging-CLI skip / 0 failed. Publisher-control job: 30 selected / 30 executed / 0 skipped / 0 failed, including staging transport only against a loopback mock registry.
  • Node20.20.1/npm10.8.2 and Node24.19.0/npm11.9.0 each report four selected / four executed / zero failed local/global/npm-exec/npx routes, one probe and one finding per route, framed LSP, invalid-command/disablement/PATH/platform controls and same-version removal/reinstall.
  • Retained native payload SHA-256 14efdf940c0c0ddcb68bef63f55795a9273297998013c209fa31ba56e332ce41; wheel SHA-256 8f5666e5d1d235b2ce3a9e260fc494b97e1ae7a294103fd10c4fc7860920aaed; effortlessmetrics-ripr-0.11.0-alpha.2.tgz SHA-256 3d2e05bc8cc8359b7b1a27a4dd5d1dfa1d3066e4096b0e91bc701a5ca06d318b. Logs bind source/tree to this PR and lock SHA-256 eb28194272c01382aaccc2af51cc15131b299396d70c49ef73c71340e1648cd7.
  • Evidence is hosted rehearsal for existing 0.11.0-alpha.2 / 0.11.0a2, not an eventual frozen RC. Logs/API metadata were read; artifact bytes were not independently downloaded or rehashed here. Final target-family, real upgrade and full first-use rows remain open.

Resource boundary: source-only connector reads plus sub-second standard-library tests; no local Cargo build. Git clone failed during network resolution, so this is a selective source inspection workspace. worktree-doctor/check-fast/precommit/full required Rust/package gates are unexecuted, not passed. Independent exact-head source/oracle review is SOURCE_CLEAR. A fresh independent execution review at 2026-10-09 20:05:31 UTC directly read all seven completed npm qualification jobs and confirmed the artifact identities, route counts and all executed controls above. The final published-head review and ordinary routed execution now passed. Legacy rust/MSRV/vscode remained intentionally label-gated and unexecuted; none is credited as executable proof. No manual labels, duplicate CI, dispatch workaround or publication was requested.

Rollback: revert this wire-identity validation and its tests/spec paragraph. Next: normal source qualification/merge if exact-head review and required checks permit; eventual frozen-SHA packaging replay remains #1467/#1578. This PR establishes no Windows install, macOS support, final RC, upgrade or public delivery claim.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e7e8a919-6662-4c14-ac1b-5b53ca6c831e

📥 Commits

Reviewing files that changed from the base of the PR and between ab61435 and b01e02f.


📒 Files selected for processing (3)
  • .github/scripts/npm_package.py
  • .github/scripts/test_npm_package.py
  • docs/specs/RIPR-SPEC-0180-npm-native-bootstrap.md

🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:


Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.



Summary by CodeRabbit

  • Bug Fixes
    • ZIP archive checks now reject entries whose literal names differ from their expected names, including names altered by backslashes or trailing NUL characters.
    • This validation applies to both wheel and qualification-artifact archives across Unix and Windows path conventions, preventing misleading entries from being accepted or read.

Walkthrough

The wheel and qualification ZIP readers now reject entries when the original member name differs from the parsed name. Tests cover backslash and NUL-suffixed aliases under both POSIX and Windows separator settings. The specification adds the same rejection requirement.

Changes

ZIP member name validation

Layer / File(s) Summary
Specify and validate ZIP member names
.github/scripts/npm_package.py, .github/scripts/test_npm_package.py, docs/specs/RIPR-SPEC-0180-npm-native-bootstrap.md
Both ZIP readers reject entries whose original names differ from their parsed names. Tests preserve malformed wire names and verify rejection of backslash and NUL-suffixed aliases under both separator settings. The specification requires rejection before member bytes are read.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk

Merge Risk: ⚪ Minimal · up to b01e0

Both ZIP admission paths are described as rejecting normalized member-name aliases before reading their contents. No actionable code risk is established; the reported exact-head checks still need to run as part of normal validation.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to b01e0

The change strengthens package admission without adding an entrypoint, increasing privileges, or changing publication behavior. Malformed ZIP names are rejected before their payloads are consumed, and rejection occurs before package or release output is created.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The changed controls cover qualification artifact members and native wheel members used by this npm package. They add neither filesystem extraction nor archive-selected execution: the readers return validated byte mappings to existing packaging and admission callers.

Security Findings and Attack Paths

  • observed — The targeted input path is a malformed archive name that the ZIP library normalizes into another name. The new equality gate rejects that identity transition before reading the offending member. It strengthens a pre-existing admission boundary rather than introducing a new attack path.

Trust Boundaries and Controls

  • observed — Literal filename agreement supplements existing artifact digest and size checks, source/run/attempt binding, wheel identity and RECORD validation, and native payload digest checks. It does not replace provenance verification or grant authority based on a filename alone.

Resilience and Maintainability Implications

  • observed — A failed identity check raises ValueError and closes the archive through its context manager. Artifact validation is per-entry, so earlier valid payloads may already be in a private mapping, but no partial mapping is returned. The rejection precedes package-directory creation and release-admission output, leaving the new failure path without persistent output or a fallback admission route.



Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: preserving ZIP wire identity during npm package admission.
Description check Passed The description is detailed, relevant, and documents the behavior change, tests, hosted proof, limitations, review status, affected scope, and rollback. It does not reproduce every template heading or…

Full details: Docstring Coverage

Explanation

Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)



  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each ZIP name with care,
A backslash or NUL suffix won't pass there.
The wheel and artifact readers say no,
On Unix or Windows, the tests show.
Then off hops the rabbit, ears in the air.

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces validation to ensure that ZIP member names in wheels and qualification artifacts retain their literal wire identity, rejecting noncanonical filenames (such as those with backslashes or NUL suffixes normalized by zipfile). It includes corresponding updates to the test suite to verify this behavior, as well as updates to the specification documentation. There are no review comments, and I have no feedback to provide.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

reviewed_head_sha: b01e02f
integration_basis: main/parent ab61435; tree 8852e119bd94e49c3b0e1b0c21ccfde0b7f2c3c7
claim_boundary: source-owned wheel/qualification ZIP wire-name refusal; no product/platform/release claim

changed_surfaces_and_semantic_owners_inspected: complete three-file diff, inspect_wheel/read_qualification_zip and native-input/release callers, literal zip_bytes fixture serialization, both new controls, existing healthy admission, RIPR-SPEC-0180 and read-only qualifier/publisher separation. Raw versus normalized names, NUL aliases, Windows separator behavior, executable modes, refusal before byte reads, and healthy canonical inventories were challenged.

blocking_findings: no actionable source/oracle finding.
non_blocking_suggestions: none.
refuted_or_stale_findings: malformed names survive serialization; executable fixture modes stay valid so unrelated mode rejection cannot substitute for wire refusal. Both guards execute before payload reads.

proof_and_ci_observed: root observed full native Windows Python 3.14.6 suite 30 selected / 25 executed / 5 existing Unix/transport skips / 0 failures, with connector-fetched committed files matched to local content. An independent gpt-6.1-sol reader independently confirmed exact production/test Git blob identities, ran four focused native Windows tests (new controls, healthy wheel and existing archive controls), parsed raw local and central ZIP headers, and removed the guards in memory: seven refusing subcases failed while healthy admission remained passing. Independent review at 2026-10-09 19:52:55 UTC reports SOURCE_CLEAR. Current exact-head cargo-deny and dependency-review checks passed; npm run 37983142136 is in progress and Routed Rust Small has started. rust/MSRV/vscode and Windows Advisory are skipped, not executable proof.

proof_or_review_missing: complete hosted exact-head required proof; real package/installed artifact execution from this head; full Cargo policy gates, omitted locally because heavy builds remain paused and only selective connector source exists. Independent focused review does not claim it ran the full suite.
affected_currentness_dimensions: admission implementation, test fixture wire encoding/oracle, narrow spec assertion, exact head; no changes to dependencies/toolchains/workflows or carrier basis.
residual_assumptions_and_non_claims: synthetic healthy wheel does not prove real installs or publication; five platform installs, final frozen RC identity and old-to-final upgrade remain missing. No manual CI labels or duplicate triggers.
disposition: SOURCE_CLEAR / REVIEW_INCOMPLETE; keep Draft until genuine required proof permits finish-pr merge convergence.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

reviewed_head_sha: b01e02f
integration_basis: main ab61435
reviewed_tree: 8852e119bd94e49c3b0e1b0c21ccfde0b7f2c3c7
tested_merge_subject: ec5fd47; same reviewed tree, parents equal reviewed base/head
claim_boundary: literal ZIP wire-name admission in wheel and qualification readers; no final RC/platform/publication claim

changed_surfaces_and_semantic_owners_inspected: complete three-file diff, production inspect_wheel/read_qualification_zip and native-input/release callers, raw ZIP fixture local/central headers and executable modes, healthy admission, separator/NUL counterexamples and RIPR-SPEC-0180. Existing source/oracle review remains current because head/base/diff are unchanged.
blocking_findings: none.
non_blocking_suggestions: CodeRabbit 14.29% docstring-coverage warning; documentation suggestion without a behavioral defect or inline finding. Existing functions' documentation percentage is not this admission contract.
refuted_or_stale_findings: guards reject before payload reads; malformed fixture names survive serialization and executable modes remain valid, so incidental rejection cannot satisfy the new controls.

proof_and_ci_observed:

  • Root Windows Python3.14.6: 30 selected /25 executed /5 existing skips /0 failures, exact committed files matched local. Independent reviewer verified raw headers, four focused tests and seven failing subcases after guard removal while healthy admission passed.
  • Automatic npm run37983142136 attempt1: all seven build/pip/uv/package/two pinned-client/publisher jobs executed success. Package suite29 executed/1 staging skip; mock-only publisher suite30 executed/0 skipped. Both npm clients4 selected/4 executed/0 failed routes with nonempty useful findings and teardown controls.
  • Routed37983141356 child113998510952: all22 planned commands actually invoked (12 Rust/policy/fixture +10 PR evidence), required steps and child receipt/upload success. Nextest8024 executed/8024 passed/0 skipped.
  • Result114013200336 downloaded selected child evidence and emitted verdict=passed, binding source/base/head/tree, three changed paths, pinned1.95 toolchain, Cargo.lock and runner/artifact identities. Root and independent reader read actual completed logs, not aggregate status alone.
  • Exact-head security/source-of-truth/CodeQL and mergeability checks successful. Review threads empty. Legacy rust/MSRV/vscode label-gated jobs did not execute; no skipped execution credited.
  • Fresh independent gpt-6.1-sol final inspection at2026-10-09 20:38:36 UTC returns REVIEW_READY; root verified and integrates that result.

proof_or_review_missing: none for this bounded source change. Full final-candidate packaging/Windows/macOS/upgrade/first-use proof remains separate under #1606/#1578; existing Linux alpha rehearsal is not frozen RC qualification.
affected_currentness_dimensions: implementation, fixture stimulus/oracle, narrow spec contract, published head and identical combined tree; no toolchain/dependency/workflow/security changes.
residual_assumptions_and_non_claims: logs/API evidence read; artifact bytes not independently downloaded/rehashed here. No live registry staging/publication, version/tag choice or additional platform claim. #1818/#1627/#1827 remain their existing owners.
disposition: REVIEW_READY for normal protected merge of this exact head. Supersedes the earlier pending-proof disposition.

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