Repository navigation
feat(electron): inspect packaged Electron fuse state without execution - #2399
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Review & Verification SummaryVerdict: LGTM (Approved) 🚀 1. Architecture & Security Invariants
2. Local Verification
|
|
@greptileai review |
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
|
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The path resolver discarded the identity facts established by containment checks, allowing the reader to admit a replacement path. Resolution now returns the selected file identity and every checked directory/link identity as owner facts. The reader checks those facts before and after open/read and compares bigint file metadata against the originally selected file. The provider consumes that selection directly. A regression swaps Versions/A to an outside link between selection and opening and expects refusal. Validation: source inspection, touched-file formatting, and git diff --check. Tests, builds, lint, and real-provider verification were not run, as explicitly requested by the maintainer. Candidate ordering selected a retained Versions/A before the framework's active link. Selection now follows the top-level Electron Framework binary first, then Versions/Current, and uses A only when those candidates are absent. An invalid active candidate fails closed. Added a retained-A/Current-to-B regression proving app/framework selection reads B. Validation: source inspection, touched-file formatting, and git diff --check. Tests, builds, lint, and real-provider verification were not run, as explicitly requested by the maintainer. |
Resolve current-main integration, reject overlapping Mach-O slices before repeated scanning, validate scan windows, preserve changed-path semantics, and align the guide with active framework selection. Co-authored-by: Kaoru0822 <[email protected]>
|
Maintainer follow-up and real-artifact verification are complete on What changed in the follow-up:
Real producer verification used Electron's official v44.7.1 release archives after checking all three archives against the release
For every artifact, REA found exactly one V1 sentinel and the same nine-byte wire, Under a 2-CPU / 8 GiB process-family guard, complete CLI scans took 2.26–2.54 s each with about 440 MiB peak RSS including startup. The real Linux result was 1,157 CLI tokens. A 512 MiB sparse FAT file with 128 declarations of the same slice failed closed before scanning in 1.51 s at about 304 MiB peak RSS. Validation:
|
Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: Kaoru0822 <[email protected]>
|
Final CI classification for head
Local verification after the latest conflict resolution also passed the Electron tests (30/30), the fixed Rizin/cache-policy/CI-report/native-type-binding focused set (36 passed, 1 skipped), and |
|
The collaborator merge attempt is blocked only by branch protection on the two base-test failures documented above; repository auto-merge is disabled. The PR is mergeable, Greptile is green, every Electron check passed, and there are no unresolved threads. A maintainer with bypass authority can squash-merge this head. Please retain these truthful trailers in the squash commit so the original and follow-up contributors remain credited: |
Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: Kaoru0822 <[email protected]> # Conflicts: # .agents/skills/reverse-engineer-anything/references/runtime-observation.md
Co-authored-by: Kaoru0822 <[email protected]>
|
Many thanks @N0zoM1z0 for merging the Electron fuse inspector. Reading the fuse wire statically should save agents a lot of wasted runtime attempts. |
Summary
Agents can now check whether a packaged Electron app will honor
--inspect,ELECTRON_RUN_AS_NODE, embedded ASAR integrity, and app-only loading before trying a runtime lane.inspect_electron_fuses/inspect-electron-fusesreads the fuse wire stored in the Electron binary. It does not launch the app, write to it, or use the network.No issue is linked. This is a new static, read-only primitive within the existing format-inspection scope, proposed here with the implementation.
Demo
Full-quality MP4
Simulated demo rendered from real output. Every value on screen is copied from
rea inspect-electron-fuseson this branch, run against Obsidian.app and Granola.app installed on my machine.Problem and expected behavior
observe_javascript_runtimewithelectron-mainneeds the app started with Inspector enabled. When the app'sEnableNodeCliInspectArgumentsfuse is off, Electron ignores--inspect, and the agent only finds out after a launch and a target listing that has no main-process target. On my machine that fuse is off in all three Electron apps I checked.The same fuse wire also says whether Electron validates embedded ASAR integrity and whether it loads app code only from
app.asar. That decides whether theapp.asarthatanalyze_javascript_applicationreads is the only code Electron will run, and whether an integrity contradiction reported byinspect_artifactis one Electron itself would enforce. REA had no way to read any of this.With this change, one call on a
.appbundle, the Electron Framework binary, or a Windows/Linux Electron executable returns, per slice: the sentinel offset, wire version, declared length, and every fuse as{index, name, state, raw_byte}. It also returns four labeled derivations (runtime_implications): inspector arguments honored or not,ELECTRON_RUN_AS_NODEhonored or not, embedded ASAR integrity enforced or not, and app code restricted toapp.asaror not.Change and scope
The reader streams the selected file once in 256 KiB windows, carrying a sentinel-sized overlap between windows. It records every sentinel per slice (up to 32) without choosing between them. Universal Mach-O files reuse
readMachoImagefor slice ranges, so offsets are file-absolute and each slice reports its own wire. Fuse bytes0,1andrmap to disabled, enabled and removed. Any other byte isunknownwith the raw byte kept. Indices past the version 1 name table keepname: null, and a different wire version keeps every byte but names nothing.A missing sentinel is reported as unknown with a limitation, never as "all fuses disabled". A truncated wire is marked
complete: false. Electron compiles embedded ASAR integrity validation only for macOS and Windows, so on an ELF executable that fuse byte is kept but its derivation isunknown.Bundle selection resolves
Contents/Frameworks/Electron Framework.frameworkand followsVersions/Currentonly inside the framework directory. A file selected inside the framework (for example.../Versions/Current/Electron Framework) is re-walked from the framework root, so the same links are rejected whichever way the binary is selected, andresolved_pathnames the real file.Contents,Frameworksand the framework directory itself must be real directories; a symlinked one is rejected rather than followed out of the bundle.Out of scope: changing fuse state (this tool never writes), an
inspect_artifactnext-probe hint (possible follow-up), and inferring Inspector access granted from inside app code (for exampleapp.commandLineswitches). That last case is called out as a limitation in every result.Contract and boundary impact
src/electron/ElectronFuseReader.ts(wire parsing),src/electron/ElectronFusePath.ts(selection), domain schema and derivations insrc/domain/electron/electronFuses.ts, servicesrc/application/electron/ElectronFuseService.ts.inspect_electron_fuses/inspect-electron-fuseswith onepathinput; registered next to the other Electron tools, effects entryevidence(read-only), catalog builders and capability inventory updated.relationship: "derivation"and cite the fuse index and sentinel offset they came from..agents/skills/reverse-engineer-anything/(SKILL.md andreferences/runtime-observation.md); build outputs not committed.Expected effects:
Evidence and regression coverage
src/domain/electron/electronFuses.test.ts(state decoding, unknown bytes, version mismatch, missing and truncated wires, multiple sentinels, ELF ASAR applicability);src/electron/ElectronFuseProvider.test.ts(thin, universal, PE and ELF fixtures, sentinel split across read windows, framework symlink containment for bundle, framework, and directVersions/Current/Electron Frameworkselection, and a symlinked framework directory);tests/acceptance/electronFusesCli.test.ts;tests/boundary/mcp/electronFusesMcp.test.ts; fixtures intests/fixtures/electron/fuseImage.ts.01000001on both slices001000011on both slices001011011on both slicesA full Obsidian result is 1,105 tokens (
--token-count).For evidence-bearing changes:
Validation performed
All on macOS 27 with Node 26 and the pinned npm 11.16.0, on this branch rebased on
8fc2043:Compatibility, safety, and release
Before merge
type(scope): outcome.