Skip to content

fix: preserve exec bit for unpacked files and keep lookups read-only - #501

Merged
MarshallOfSound merged 1 commit into
mainfrom
claude/issue-499-extract-fixes
Nov 24, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
claude/issue-499-extract-fixes

Conversation

@claude

@claude claude Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Requested via Slack thread

Extracting an archive lost the executable bit on unpacked files, because insertFile returned early for unpacked entries without ever recording executable in the header. Separately, looking up a missing path (via statFile, extractFile and friends) created phantom directories in the cached archive header, which then showed up in listPackage and extractAll, and lookups of names like toString resolved to Object.prototype members of the JSON-parsed header. This PR records the exec bit for unpacked files, makes lookups read-only and guards child lookups with Object.hasOwn, and adds tests for all three, based on the reproducers @trackoor provided in #499. The directory-symlink traversal bug also reported in #499 (paths more than one level under a directory symlink) is not covered here and stays open.

Refs #499


Generated by Claude Code

Filesystem.insertFile returned early for unpacked files without recording
`executable`, so extractAll wrote unpacked executables as 0644. Record the
bit in the unpacked branch too; extractAll already chmods files whose header
entry is executable, including unpacked ones.

searchNodeFromDirectory created missing intermediate directories even when
called from getNode, so a failed statFile/extractFile added phantom
directories to the cached header that then showed up in listPackage and
extractAll. Add a `create` parameter (default true for packing) and pass
false from getNode so lookups return "not found" without mutating the
header. Child lookups also check Object.hasOwn so names like "toString" no
longer resolve to Object.prototype members of the JSON-parsed header.

Refs #499

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PiGRtB1rbGBBVHSbsGRUQ5
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) November 24, 2026 18:22
@MarshallOfSound
MarshallOfSound merged commit 9eeb118 into main Nov 24, 2026
11 checks passed
@MarshallOfSound
MarshallOfSound deleted the claude/issue-499-extract-fixes branch November 24, 2026 18:24

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 4.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants