Files
rea/docs/electron-fuses.md
T
ec67aebed0 fix(electron): preserve selected fuse inspection paths (#3104)
Preserve caller-selected POSIX symlink/parent paths during CLI anchoring and
Electron bundle traversal. Resolve terminal directory suffixes through checked
real directories, retaining their identities for before/after readback. Keep
the existing Windows CLI resolution, bounded scan, and output contracts.

Validation: six regressions reproduced on main 7ad75bdc8; 41 focused tests pass
with one Windows-only skip. Full static/docs checks and final main-sync fast
checks pass. Official Electron v44.7.1 release archives, extracted executable
hashes and independent fuse wires verify actual ELF/PE/Mach-O bytes. Real CLI
and stdio MCP reproduce main's wrong target and confirm corrected artifact
identity plus CLI/MCP parity; owned MCP servers exit. Equivalent direct-file
outputs remain 963-1,054 o200k tokens. Individual timing measurements and their
limits are recorded in the PR; no speedup is claimed. Native Windows/macOS REA
execution and target application execution are not claimed.

Co-authored-by: Yann Roberto <165009858+shoyann@users.noreply.github.com>
Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-14 12:49:17 +08:00

4.1 KiB

Electron fuse state

inspect_electron_fuses / inspect-electron-fuses answers whether a packaged Electron app will honor --inspect and --inspect-brk, ELECTRON_RUN_AS_NODE, embedded ASAR integrity validation, and loading application code only from app.asar. It reads the fuse wire stored in the Electron binary. It does not launch the app, modify fuse bytes, or use the network.

rea inspect-electron-fuses /Applications/Example.app --json

The CLI resolves a relative path against the caller's working directory. MCP requires an absolute filesystem path and preserves that exact selection:

{
  "name": "inspect_electron_fuses",
  "arguments": { "path": "/Applications/Example.app" }
}

On POSIX hosts, the CLI preserves path components so symlinks are followed before parent (..) steps. Bundle selections may end in . or parent steps through real directories; a terminal parent step through a directory symlink is rejected. Windows CLI paths retain native drive and separator resolution.

Check this before observe_javascript_runtime with electron-main. When EnableNodeCliInspectArguments is disabled or removed, Electron ignores Inspector flags, and a later target listing can simply show no main-process target.

What is read

On macOS, pass the .app bundle or the Electron Framework binary. Bundle and framework selection first tries the top-level Electron Framework binary, then Versions/Current/Electron Framework, then Versions/A/Electron Framework. Symlinks are followed only while they stay inside that framework. On Windows and Linux, pass the main Electron executable. The wire lives in that executable rather than in app.asar.

The inline Evidence result contains:

  • the selected path, the resolved regular file, its SHA-256, size, and container format (mach-o, mach-o-universal, pe, or elf);
  • one slice entry for a thin Mach-O, PE, or ELF file, and one entry per slice of a universal Mach-O, with file-absolute sentinel_offset values;
  • wire_version, declared_length, and ordered fuses { index, name, state, raw_byte };
  • sentinel_count, including zero and more than one;
  • runtime_implications, each marked relationship: "derivation" and tied to the fuse index it came from.

Version 1 names, in index order, are RunAsNode, EnableCookieEncryption, EnableNodeOptionsEnvironmentVariable, EnableNodeCliInspectArguments, EnableEmbeddedAsarIntegrityValidation, OnlyLoadAppFromAsar, LoadBrowserProcessSpecificV8Snapshot, GrantFileProtocolExtraPrivileges, and WasmTrapHandlers. An index past that table, or any index on another wire version, keeps name: null and the raw byte.

Wire bytes are 0x30 disabled, 0x31 enabled, and 0x72 removed. Any other byte is unknown. A removed fuse is not enabled: Inspector flags and ELECTRON_RUN_AS_NODE are not honored, and application code is not restricted to app.asar. On macOS and Windows, a removed or disabled EnableEmbeddedAsarIntegrityValidation byte means embedded ASAR integrity is not enforced, and an enabled byte means it is enforced. Electron compiles that validation only on macOS and Windows. On a Linux ELF executable the observed byte is preserved and the enforcement outcome is unknown.

Unknown and multiple sentinels

No sentinel means the fuse state is unknown. It does not mean the fuses are disabled. A wire that continues past the slice is reported as truncated, with only the fuse bytes that were present. Two or more sentinels in one slice are all reported. REA does not pick one.

Fuse bytes do not prove that the application enables Inspector some other way, for example through app.commandLine or a remote-debugging switch in application code.

The selected file must be a regular file, or a bundle that resolves to one. Symlinks are followed only inside Electron Framework.framework. The reader admits at most 1 GiB, searches with 256 KiB windows, and keeps at most 32 sentinels per slice. A real nine-fuse, one-slice result is about 1,200 CLI tokens; a two-slice result is about 1,300 tokens. Exact size varies with path lengths and limitations. This inspection creates no temporary files and does not modify the selected bytes.