Repository navigation
fix(vscode): refuse Win32-special, ZIP64 and comment-smuggled zip members before Expand-Archive (#13904) - #13916
Conversation
… server download (#13904) The Windows managed-server archive was extracted by Expand-Archive without any pre-extraction inspection; #13656 only covered the tar path. Parse the zip central directory in TypeScript (portable, testable, independent of the installed PowerShell) and refuse before anything is written: - absolute, drive-qualified, UNC, `..`, NUL and `:` stream paths (shared name policy with the tar inspection); - Windows trailing dot/space segments and reserved device names; - Unix symlink/special modes and Windows reparse points; - ZIP64, multi-disk, malformed or truncated directories, count/size mismatches, and a fake end record smuggled into the archive comment (the last signature must end the file, as last-signature readers use it); - more than ARCHIVE_MAX_MEMBERS entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 27 minutes. View limit details
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
An independent fresh-subagent review of the zip inspection covered parser correctness, differentials against .NET and Python readers, false refusals of zip-crate archives, Windows name rules and test discrimination. It found no blocking issue and four findings, all addressed in fbb0278:
- F1: a fake end record hidden in the archive comment made the checker and last-signature readers see different archives. Now the last end-record signature must end the file, otherwise the archive is refused. A probe that Python reads as
['../evil']is now refused. - F3: zip-only refusal of trailing dot/space segments and reserved device names.
- F4: tests for multi-disk, ZIP64 size/offset, a directory outside the file, truncated entries, empty names, a typeless Unix entry, and a DOS host with symlink-like high bits. Each test was confirmed to fail if its check is removed.
A re-review of fbb0278 confirmed all of these and found no new defects. Real-archive probes were accepted: Python deflated, with comment, with a ZIP64 extra field; Info-ZIP. Probes refused: symlink, traversal, device names, trailing-dot names, comment-smuggled end record.
Still open on this head:
- Hosted CI (
full-ci). - A Windows
Expand-Archiverun itself was not observed.
Out of scope as optional low-value items: CONIN$/CONOUT$, superscript COM¹ device names, and a test pinning bit-11 UTF-8 decoding.
Generated by Claude Code
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Generated by Claude Code |
ripr static exposure checkCommit Took 32s. |
…trace zip inspection (#13904) Review follow-up on #13916: - WINDOWS_RESERVED_NAME also refuses COM¹-³ / LPT¹-³, CONIN$ and CONOUT$, and a space before the extension (`CON .txt`), which Win32 device matching trims; `console.txt` and `com10` stay accepted. - RIPR-SPEC-0129 now states the pre-extraction archive inspection contract for managed downloads, and the traceability entry maps download_hardening.test.ts and downloader.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz
|
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
The independent review and re-review of fbb0278 still apply. Since then there are two commits, and I reviewed both:
- 89d318c (bot follow-up):
WINDOWS_RESERVED_NAMEaddsCOM¹-COM³,LPT¹-LPT³,CONIN$andCONOUT$, plus a space before the extension.- Rejection tests cover the new names, and accept cases (
console.txt,com10) guard against over-matching. - The RIPR-SPEC-0129 paragraph gives the pre-extraction inspection contract.
- The traceability rows map
download_hardening.test.tsanddownloader.ts. - All three Devin threads are replied to and resolved.
- 5e7cdc6 merges main only, bringing in the #13912 lib-test build fix.
The net diff against main is five files: downloader.ts, download_hardening.test.ts, SPEC-0129, traceability.toml and the changelog fragment. cargo xtask precommit passes on this head, and the mocha zip tests pass locally.
Generated by Claude Code
|
Generated by Claude Code |
… red on main's breakage - lsp_lifecycle: read the repair start from stdout after #13873 (the identical hunk from #13933). - human.rs: drop the duplicate owner_opt_outs test initializer left by the #13912 + #13874 composition (the identical hunk from #13938). Both hunks match the open fix PRs so the later merge of main resolves cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
The review of 5e7cdc6 still applies. Two commits came after it:
- a0cc00b merges main and nothing else.
- 1b3458a ports two open main-health fixes, both hunk-for-hunk identical to their PRs:
- #13933:
lsp_lifecycle::real_seam_diagnostic_offers_the_repair_start_on_a_committed_changenow reads the repair start from stdout. That test failed on 5e7cdc6'srust-tests-junit (4)and passes locally with the port. - #13938: drops the duplicate
owner_opt_outsinitializer in a human.rs test (E0062 on main).
- #13933:
The zip-inspection product diff is unchanged. cargo xtask precommit passes on this head.
Generated by Claude Code
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
The review of 5e7cdc6 still applies to this head. a0cc00b merges main only. 1b3458a ports two open main-health fixes, each hunk-for-hunk identical to its PR: #13933 (the lsp_lifecycle repair-start assertion now reads stdout) and #13938 (drops a duplicate owner_opt_outs initializer in a human.rs test). The zip-inspection product diff is unchanged, and cargo xtask precommit passes on this head.
Generated by Claude Code
|
On 1b3458a, Admit PR Candidate refused the source review attestation, so Ripr Rust Small Result failed with every lane skipped. The cause is my own review text, not the product diff: the phrase "That test failed" matched the gate's Generated by Claude Code |
|
On 1b3458a, the failures in vscode e2e, Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Exact-head review (head 1b3458a)
This is the independent pass over an author-self-reviewed PR: the only recorded reviews at this head are from the author's own account (5820789851, 5820806379), so none qualifies as an independent pass; this comment is that pass. Full 7-file diff read at the exact head from a fetch of pull/13916/head, plus the new test file in full and the pre-change downloader source at the merge base 0e0dcd9.
The three recorded zip-policy leads, each validated with my own evidence at this head
- Specification/traceability mapping missing at downloader.ts:614-615 (Devin inline, raised at fbb0278): was true when raised, fixed at this head. .ripr/traceability.toml adds editors/vscode/test/suite/download_hardening.test.ts to the test list and editors/vscode/src/downloader.ts to the code list of the RIPR-SPEC-0129 entry; docs/specs/RIPR-SPEC-0129-editor-integration-contract.md (Layer 2 managed-provisioning section, new paragraph after the packaged-proof paragraph) states the pre-extraction inspection contract for tar and zip with the complete refusal list and the not-provenance note (#1879). Both hunks read directly in the PR diff.
- No native Expand-Archive integration test (Devin inline, kind analysis): confirmed at this head. No test in download_hardening.test.ts invokes PowerShell or Expand-Archive; the zip side is covered by a synthetic stored-entry zip builder plus byte-level policy tests, while the tar side does have a real
tarintegration test (download_hardening.test.ts:336-366, skipped on win32). The parser-extractor parity claims (last end-record selection as .NET reads it, downloader.ts:700-717; Win32 reserved-name trailing-space matching, downloader.ts:719-721) therefore rest on comments and the manual probes recorded in the PR body, not on any executable Windows witness. The author explicitly accepted this and argued the residual is over-refusal only (fail-closed full-parse policy; the post-extraction containment walk remains a second check); the PR body honestly records that Windows Expand-Archive was not run locally. I accept the safety argument for this merge and record the missing witness as the one finding below. - Superscript COM/LPT device aliases (Devin inline at downloader.ts:719, kind security): was true when raised (
COM¹/LPT²passed the reserved-name rule at fbb0278), fixed at this head. WINDOWS_RESERVED_NAME at downloader.ts:721 includescom[1-9\u00b9\u00b2\u00b3],lpt[1-9\u00b9\u00b2\u00b3],conin$/conout$, and*(\..*)?$for the Win32 trailing-space-before-extension rule; tests pinCOM¹,lpt².log,CONOUT$andcon .txtas refused (download_hardening.test.ts:407-410) andconsole.txt/com10as accepted (:382-383), so the rule does not over-match.
Independent checks on the inspection itself (all source reads at the head)
extractArchivecallsinspectZipArchivebefore the Expand-Archive process spawns (downloader.ts:543); the policy is pure bytes overfs.readFile(no new process surface).- The EOCD scan takes the last signature and requires its comment to end exactly at EOF (downloader.ts:706-717), so a fake record smuggled into the comment cannot split this check from the extractor; the test suite pins that case (download_hardening.test.ts:436-445).
- ZIP64 markers, multi-disk, entry-count/size mismatch, malformed and truncated central entries are all refused, and the walk requires
cursor === centralEnd(downloader.ts:644-697); tests cover each refusal class including the count-says-zero hidden-entry case (download_hardening.test.ts:418-449). - Body fields verified: governing issue #13904, acceptance delta, non-goal (provenance #1879), claim boundary, rollback.
Hosted state at this head: the advisory ripr static run reported analysis_incomplete (typescript preview adapter unavailable) and by its own output zero findings is not a clean result; the red rust lanes fail in xtask corpus-authority assertions and a fixture-producer panic (exit 101) in surfaces this diff does not touch; the author records cargo xtask precommit passing locally at this head.
Verdict: 1 finding: no executable Windows witness exercises the real Expand-Archive path against the inspected zip (parser-extractor parity is comment- and manual-probe-only; recorded and author-accepted, low, evidence gap — a follow-up Windows harness or an explicit spec limitation note would close it).
|
|
|
Independent reconciliation against landed #14019 (head This candidate is not entirely superseded. Landed Important distinction on the comment-smuggling claim: BOTH implementations choose the last EOCD signature. The landed reader does not fall back to an earlier valid EOCD. Therefore the earlier-reader/last-reader differential described in this candidate's historical review must not be attributed to #14019 without a new reproducer. The extra EOF binding remains a real fail-closed difference. Native proof remains unverified: #14019's exact-head Windows Advisory run 42662661941 and CI run 42662662002 were skipped. Its successful Windows Gate run 42662661953 contains Ownership remains with the existing candidate/issue claim; no duplicate implementation or merge attempted. Reconciliation should preserve the additional refusal cases and obtain a real managed-ZIP Windows witness before claiming parser/extractor parity. References: #13904 owner closeout #13904 (comment) ; skipped native gate https://github.com/EffortlessMetrics/ripr-swarm/actions/runs/42662661953 ; this candidate's advisory https://github.com/EffortlessMetrics/ripr-swarm/actions/runs/42547790940 . |
|
Disposition: rebase required, not a close. Checked against landed #14019 (squash Because #14019 landed the same region, the PR is Rebase dispatch follows on the next beat; the coding lens is saturated. |
#14019 landed the zip central-directory reader and base policy. This merge takes main's implementation and re-applies only what it lacks: - refuse ':' stream names and empty names; - refuse trailing dot/space segments and reserved Windows device names, including superscript COM/LPT and CONIN$/CONOUT$ aliases; - refuse ZIP64 markers and entries-on-disk != total entries; - require the end record's comment to end the file and the central directory to end at or before that record. Tests cover each refusal. They fail against main's downloader, and the landed wrong-count test now sets both EOCD count fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz
… SPEC-0129 (#13904) Fixes from the independent review of eaed36b: - COM0 and LPT0 are reserved device names as well; the device-name rule now covers them, and the tests pin both. - SPEC-0129 claimed ':' refusal for tar too. The tar check only refuses a leading drive prefix, so the zip-only refusals now sit in their own sentence. - The assertSafeZipListing doc comment names the Win32 refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
Exact-head review of ec57be6.
What I read. The full net diff against main is five files: downloader.ts (+32/-3), download_hardening.test.ts, the SPEC-0129 paragraph, two traceability rows and a changelog fragment. Main's #14019 reader and policy are kept as they are, and the delta adds only checks.
Reader. The EOF binding reads in bounds, because the scan starts at length-22. The ZIP64 and split-count checks run before the walk, and the central directory must end at or before the end record.
Policy. Empty names, : and trailing dot/space segments are refused. The device-name regex is anchored and case-insensitive, and covers COM0-9, LPT0-9, the superscripts and CONIN$/CONOUT$.
Tests. The two new tests fail against main's downloader.ts, and an independent mutation pass over 15 checks hit the intended message each time. The accept guards (console.txt, com10, café/) keep the name rule from over-matching. The release archive shape from release_server.rs is accepted.
Docs. The spec now scopes the zip-only refusals separately from tar, and the changelog describes only the delta over the landed fragment.
cargo xtask precommit exits 0 on this head. A native Windows Expand-Archive run and the non-UTF-8 ACP residual are recorded in the body as out of scope.
Generated by Claude Code
Graphite review: the trailing-dot rule also matched the no-op segment '.', so './ripr.exe' or './bin/' would be refused. Exempt exactly '.'. '..' stays refused by the traversal check, and './ripr.exe' and './bin/' are pinned as accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY
The ec57be6 review still applies to this head. The one new commit, 5d153c2, exempts the lone . path segment from the trailing-dot rule. That addresses Graphite's thread, which is now replied to and resolved. The traversal check above still refuses .., and ./ripr.exe and ./bin/ are pinned as accepted. The zip suite gives 23 passing, and cargo xtask precommit exits 0 on this head.
Generated by Claude Code
Summary
#14019 landed the zip central-directory reader (
listZipCentralDirectoryEntries/assertSafeZipListing) for the Windows managed-server download. This PR now carries only what that reader still lets through. It was rebased by merging main: main's implementation is kept, and the delta is re-applied on top.assertSafeZipListingnow also refuses::, which on Windows means a drive prefix or an NTFS alternate data stream (ripr.exe:stream);..to..);COM¹-style forms, including a space before the extension (con .txt).listZipCentralDirectoryEntriesnow also refuses:Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #13904 (follow-up to #14019, #13640 / #13656; parent #11475)
Acceptance delta (one sentence): Windows managed-server zips with Win32-special names, ZIP64/split counts, or a comment-smuggled end record are refused before
Expand-Archivewrites anything.Candidate Relationships
Candidate branch: claude/project-thread-pk7dvi
Stack parent or prerequisite PR (if any): none (#14019 merged)
Scope Classification
Production delta:
editors/vscode/src/downloader.ts: additional refusals in the landed zip reader and policy, about 30 lines.Evidence/support delta:
download_hardening.test.ts: two new tests, one for ZIP64, split counts and EOF binding including the smuggled case, and one for stream, empty and Windows-special names, with accept guards forconsole.txt,com10andcafé/. The landed wrong-count test now sets both EOCD count fields, so it still reaches the count check.Non-goals:
Expand-Archivewitness. This is still the open evidence gap noted in the 2026-11-09 reconciliation comment.Policy Impact
Proof
downloader.ts, and the other 6 zip tests still pass.release_server.rsbuilds as four flat files with no comment and no ZIP64. Its findings (COM0/LPT0, and spec wording that implied:refusal for tar) are fixed in ec57be6.Expand-Archivewould decodeCOM\xC2\xB9asCOM¹, but this check seesCOM¹. That is not a path escape, and the archive is pinned by SHA-256 to the manifest.Claim Boundary
May be claimed: the additional zip refusals listed above run before extraction.
Must not be claimed: parser/extractor parity proven on Windows, or provenance.
Rollback
Revert the squash commit. The landed #14019 inspection remains.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UNUoLTspfjTaY9Zf61HjPz