[PR #6769] [CLOSED] fix(zip): report symlinks declared without permission bits #7409

Closed
opened 2026-11-01 21:47:38 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6769
Author: @Sriram-PR
Created: 10/23/2026
Status: ❌ Closed

Base: main ← Head: fix/zip-symlink-without-permissions


📝 Commits (1)

  • 1612b00 fix(zip): report symlinks declared without permission bits

📊 Changes

2 files changed (+29 additions, -2 deletions)

View changed files

📝 src/artifacts/ZipArtifactReader.test.ts (+26 -0)
📝 src/artifacts/ZipArtifactReader.ts (+3 -2)

📄 Description

Summary

ZipArtifactReader decided symlinks with its own check on entry.unixMode, but zip.js leaves that optional field unset when the upper external-attribute bits carry no permission bits, as in a 0120000 symlink. zip.js still sets entry.symlink from those same bits, so the type was already parsed; rea just ignored it. The member came out as kind: "file" with no symlink limitation, while the 0120777 control was a symlink.

Fixes #6751

Problem and expected behavior

Smallest trigger: a ZIP written with versionMadeBy: 0x0314, msDosCompatible: false and external attributes 0o120000 << 16 for one member. ZipArtifactReader.entries() on main reports kind: "file". Expected: kind: "symlink", like the 0o120777 case.

Change and scope

  • isSymlink now returns zip.js's entry.symlink, which zip.js derives from unixMode when present and otherwise from the upper external attributes (lib/core/zip-reader.js in 2.15.0). That was the only unixMode check in src; both the projection and the regular-file guard in open use it.
  • Not included: no change to directory or executable handling, which already come from zip.js.

Contribution scope: ordinary fix within existing boundaries; no scope decision needed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: isSymlink in src/artifacts/ZipArtifactReader.ts.
  • Contribution scope fit and linked maintainer decision: not applicable (bug fix, #6751).
  • CLI and MCP/tool-catalog contract: no schema change; such members now report kind: "symlink" with the existing symlink limitation.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: the occurrence kind above.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/artifacts/ZipArtifactReader.test.ts adds reports a ZIP symlink declared with Unix mode %s as a symlink for 0120000 and the 0120777 control, built with zip.js like the existing symlink test in artifactZipRelativePaths.test.ts.
  • Base reproduction: the 0120000 case fails on main's source with:
    -     "kind": "symlink",
    +     "kind": "file",
    
    and the 0120777 case passes on both.
  • User-visible CLI/MCP output: the member's occurrence now has entry_kind: "symlink" and the symlink limitation.
  • Remaining proof gaps: only zip.js-written fixtures, not ZIPs from other tools.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- src/artifacts/ZipArtifactReader.test.ts: 14 passed (the 0120000 case fails on main's source)
  • npm run test:focused -- the ZIP reader, artifactZipRelativePaths, zipDetection and the other tests that use ZipArtifactReader: 173 passed across 8 files
  • npm run check:fast: typecheck and lint passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux x64, Node 24.18.0.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: symlink members are still never followed or extracted as regular files; this only makes more of them get recognized.

Author readiness

Human owner: @Sriram-PR

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6769 **Author:** [@Sriram-PR](https://github.com/Sriram-PR) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/zip-symlink-without-permissions` --- ### 📝 Commits (1) - [`1612b00`](https://github.com/morluto/rea/commit/1612b001ac62f07ac339503e640376dabeca3858) fix(zip): report symlinks declared without permission bits ### 📊 Changes **2 files changed** (+29 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/ZipArtifactReader.test.ts` (+26 -0) 📝 `src/artifacts/ZipArtifactReader.ts` (+3 -2) </details> ### 📄 Description ## Summary `ZipArtifactReader` decided symlinks with its own check on `entry.unixMode`, but zip.js leaves that optional field unset when the upper external-attribute bits carry no permission bits, as in a `0120000` symlink. zip.js still sets `entry.symlink` from those same bits, so the type was already parsed; rea just ignored it. The member came out as `kind: "file"` with no symlink limitation, while the `0120777` control was a symlink. Fixes #6751 ## Problem and expected behavior Smallest trigger: a ZIP written with `versionMadeBy: 0x0314`, `msDosCompatible: false` and external attributes `0o120000 << 16` for one member. `ZipArtifactReader.entries()` on main reports `kind: "file"`. Expected: `kind: "symlink"`, like the `0o120777` case. ## Change and scope - `isSymlink` now returns zip.js's `entry.symlink`, which zip.js derives from `unixMode` when present and otherwise from the upper external attributes (`lib/core/zip-reader.js` in 2.15.0). That was the only `unixMode` check in `src`; both the projection and the regular-file guard in `open` use it. - Not included: no change to directory or executable handling, which already come from zip.js. Contribution scope: ordinary fix within existing boundaries; no scope decision needed. ## Contract and boundary impact - Semantic owner and earliest changed stage: `isSymlink` in `src/artifacts/ZipArtifactReader.ts`. - Contribution scope fit and linked maintainer decision: not applicable (bug fix, #6751). - CLI and MCP/tool-catalog contract: no schema change; such members now report `kind: "symlink"` with the existing symlink limitation. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: the occurrence kind above. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `src/artifacts/ZipArtifactReader.test.ts` adds `reports a ZIP symlink declared with Unix mode %s as a symlink` for `0120000` and the `0120777` control, built with zip.js like the existing symlink test in `artifactZipRelativePaths.test.ts`. - Base reproduction: the `0120000` case fails on main's source with: ``` - "kind": "symlink", + "kind": "file", ``` and the `0120777` case passes on both. - User-visible CLI/MCP output: the member's occurrence now has `entry_kind: "symlink"` and the symlink limitation. - Remaining proof gaps: only zip.js-written fixtures, not ZIPs from other tools. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- src/artifacts/ZipArtifactReader.test.ts`: 14 passed (the `0120000` case fails on main's source) - `npm run test:focused --` the ZIP reader, `artifactZipRelativePaths`, `zipDetection` and the other tests that use `ZipArtifactReader`: 173 passed across 8 files - `npm run check:fast`: typecheck and lint passed ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Linux x64, Node 24.18.0. - Package or release metadata impact: none. - Security, privacy, process, or containment review: symlink members are still never followed or extracted as regular files; this only makes more of them get recognized. ## Author readiness Human owner: @Sriram-PR - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:47:38 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7409
No description provided.