Skip to content

fix(archive): use the extractor path key for ZIP collisions - #832

Merged
steipete merged 2 commits into
openclaw:mainfrom
SebTardif:fix/fs-safe-f015
Oct 5, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
SebTardif:fix/fs-safe-f015

Conversation

@SebTardif

@SebTardif SebTardif commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

ZIP preflight and bounded reads now use the extractor's canonical path key for collision detection. path.posix.normalize retained directory trailing separators, so A/ and a could evade the shared case-insensitive NFC collision policy. stripArchivePath(entryPath, 0) removes the separator consistently with extraction.

Raw-name validation rejects traversal, absolute paths, NULs, and empty physical ZIP names before collision tracking. Root markers do not alias real member paths; repeated separators and dot components retain the extractor's existing identity. Tests cover both entry orders, case and Unicode aliases, root-marker bounded reads, and native/JavaScript admission.

Validation: 223 focused tests passed with the macOS native addon loaded, covering off/require/auto-native/auto-missing modes. Codex autoreview is clean at P0–P2. Full pnpm check passed lint, build, allocator-build, and documentation checks locally, but the full test phase was stopped after widespread timing failures on a busy host; exact-head hosted CI is the cross-platform gate. Documentation and the Unreleased changelog are updated.

Thanks @SebTardif for the fix.

Exact-head CI passed on a3fbe35a035c73a0221fb9592a56d92526394d5a: all OS lanes, coverage, benchmarks, and CodeQL. CI run.

@SebTardif
SebTardif requested a review from a team as a code owner October 4, 2026 02:44
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed October 4, 2026, 10:59 PM ET / October 5, 2026, 02:59 UTC (Revision 3).

ClawSweeper review

What this changes

The PR makes ZIP collision checks use extraction’s canonical path identity and adds regression coverage, documentation, and a changelog entry.

Merge readiness

⛔ Blocked before merge - 2 items remain

The fix remains necessary: current main and v0.23.0 retain the trailing-separator collision gap. No introduced correctness defect was found, but the external-contributor runtime proof requirement remains unmet.

Priority: P2
Reviewed head: a3fbe35a035c73a0221fb9592a56d92526394d5a

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused patch and regression coverage are sound, but test-only evidence leaves the required real runtime proof outstanding.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Needs real behavior proof before merge: the changed tracker governs ZIP admission and native manifest validation before readArchiveEntry returns bytes. The captured evidence reports tests and CI, but no standalone native after-fix result showing rejection of an unrelated bounded read from a ZIP containing A/ and a. Add redacted terminal output, logs, or a linked runtime artifact; screenshots or recordings also count when they show the result. Remove private paths, credentials, IP addresses, and endpoints. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Needs real behavior proof before merge: the changed tracker governs ZIP admission and native manifest validation before readArchiveEntry returns bytes. The captured evidence reports tests and CI, but no standalone native after-fix result showing rejection of an unrelated bounded read from a ZIP containing A/ and a. Add redacted terminal output, logs, or a linked runtime artifact; screenshots or recordings also count when they show the result. Remove private paths, credentials, IP addresses, and endpoints. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Verified introduced change: The pinned main-to-head diff changes only the shared tracker, two test files, archive documentation, and the Unreleased changelog. Canonicalization now removes trailing separators before case-insensitive NFC comparison; raw-name validation remains in the callers.
Current main still needs the repair: Current main uses path.posix.normalize directly in the collision tracker, preserving the terminal slash and distinguishing A/ from a after lowercasing.
Latest release retains the gap: The v0.23.0 tracker also uses the older normalization expression; the submitted trailing-separator repair is not present in that release.
Findings None None.
Security None None.

How this fits together

fs-safe validates untrusted ZIP member names before extraction or bounded reads. Its shared collision tracker feeds physical archive admission and decoder validation so ambiguous names reject before files or requested bytes are returned.

flowchart TD
  A[Untrusted ZIP members] --> B[Validate raw names]
  B --> C[Canonical path identity]
  C --> D[Case and Unicode collision check]
  D --> E[Reject ambiguous archive]
  D --> F[Validate decoder entries]
  F --> G[Extract files or return bounded bytes]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Needs real behavior proof before merge: the changed tracker governs ZIP admission and native manifest validation before readArchiveEntry returns bytes. The captured evidence reports tests and CI, but no standalone native after-fix result showing rejection of an unrelated bounded read from a ZIP containing A/ and a. Add redacted terminal output, logs, or a linked runtime artifact; screenshots or recordings also count when they show the result. Remove private paths, credentials, IP addresses, and endpoints. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - Provide the redacted native after-fix bounded-read transcript requested by the previous review, then update the PR body for re-review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +7/-3; tests +19/-1 The small production increase is justified by reusing extraction’s canonical identity, with focused admission regression coverage.

Technical review

Best possible solution:

Keep one canonical collision policy shared by extraction and ZIP admission, preserving raw-name rejection and validating the repaired bounded-read behavior with native runtime evidence.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the path: the current-main tracker gives A/ and a different keys, allowing the native bounded-read collision check to miss them. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes, reusing extraction’s existing canonicalization is the narrowest repair; it retains raw validation and avoids a competing normalization policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 68416a3367f6.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded ZIP admission inconsistency without evidence of an urgent user-facing outage.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Needs real behavior proof before merge: the changed tracker governs ZIP admission and native manifest validation before readArchiveEntry returns bytes. The captured evidence reports tests and CI, but no standalone native after-fix result showing rejection of an unrelated bounded read from a ZIP containing A/ and a. Add redacted terminal output, logs, or a linked runtime artifact; screenshots or recordings also count when they show the result. Remove private paths, credentials, IP addresses, and endpoints. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Verified introduced change: The pinned main-to-head diff changes only the shared tracker, two test files, archive documentation, and the Unreleased changelog. Canonicalization now removes trailing separators before case-insensitive NFC comparison; raw-name validation remains in the callers. (src/archive-entry.ts:108, a3fbe35a035c)
  • Current main still needs the repair: Current main uses path.posix.normalize directly in the collision tracker, preserving the terminal slash and distinguishing A/ from a after lowercasing. (src/archive-entry.ts:105, 68416a3367f6)
  • Latest release retains the gap: The v0.23.0 tracker also uses the older normalization expression; the submitted trailing-separator repair is not present in that release. (src/archive-entry.ts:105, 223a30531ea8)
  • Admission precedes selected-byte return: Physical ZIP admission validates raw names before calling the tracker. Bounded reads admit the complete archive, validate the native manifest when applicable, and only then read the selected entry. The patch strengthens this existing boundary without changing authority or guarded filesystem operations. (src/archive-read.ts:254, a3fbe35a035c)
  • Focused regression coverage: Added cases cover both entry orders, case and Unicode aliases with terminal separators, root markers, and empty physical names. The rejection helper checks extraction and an unrelated bounded read, preserves sentinels, and runs across native and JavaScript modes when the native addon is available. (test/archive-zip-admission.test.ts:60, a3fbe35a035c)
  • Prior review follow-up: The captured previous review requested native runtime proof and an Unreleased changelog entry. The changelog request is fulfilled. The complete captured body reports 223 focused macOS native-addon tests and partial local pnpm check validation, but supplies no standalone after-fix runtime transcript or artifact. Tests and CI remain supplemental proof. (CHANGELOG.md:7, a3fbe35a035c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • SebTardif: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted after-fix native runtime transcript showing an unrelated bounded read rejects a ZIP containing A/ and a with entry-path.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-04T02:47:14.000Z sha b4849af :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T02:45:41.110Z sha b4849af :: needs real behavior proof before merge. :: none

SebTardif and others added 2 commits October 4, 2026 19:50
path.posix.normalize keeps a directory trailing slash, so a native bounded read treated A/ and a as different names. Collision checks now use the same stripped case-insensitive NFC key as extraction.

Signed-off-by: Sebastien Tardif <[email protected]>
@steipete
steipete merged commit e8f4c4f into openclaw:main Oct 5, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants