[PR #3605] [MERGED] fix(electron): reject active scenario capture when inspect fuse is disabled (#3453) #5852

Closed
opened 2026-10-31 01:09:55 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3605
Author: @HarsH-1877
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @baron

Base: main ← Head: fix/electron-inspect-arguments-fuse-3453


📝 Commits (5)

  • 2ed3f54 feat(electron): add EnableNodeCliInspectArguments fuse pre-flight helper
  • bc32ee5 fix(electron): reject active scenario capture when inspect fuse is disabled (#3453)
  • 816dbd0 docs(electron): document inspect fuse pre-flight refusal for scenario capture (#3453)
  • 8b28b03 test(electron): add PE, ELF, and abort-signal coverage for fuse pre-flight (#3453)
  • 1369fcd fix(electron): resolve macOS framework binary and enforce startup deadline on fuse preflight (#3453)

📊 Changes

5 files changed (+319 additions, -1 deletions)

View changed files

📝 docs/electron-observation.md (+6 -0)
➕ src/browser/PlaywrightElectronActiveFuses.test.ts (+167 -0)
➕ src/browser/PlaywrightElectronActiveFuses.ts (+96 -0)
📝 src/browser/PlaywrightElectronActiveProvider.test.ts (+39 -1)
📝 src/browser/PlaywrightElectronActiveProvider.ts (+11 -0)

📄 Description

Summary

Fixes #3453. In active Electron scenario capture (capture_electron_scenario), Playwright attaches to the target Electron main process using Node CLI inspect arguments (--inspect=0 or --remote-debugging-port=0). When an Electron executable has the EnableNodeCliInspectArguments fuse explicitly disabled or removed, the runtime silently ignores inspection flags, causing Playwright to hang for the full 60-second startup deadline before timing out.

This PR adds a pre-flight fuse inspection before process launch. If the executable explicitly disables or removes EnableNodeCliInspectArguments, capture() immediately fails fast with a typed AnalysisUnsupportedTargetError ("unsupported_target") without spawning processes or waiting for the startup deadline.

Problem and expected behavior

  • Trigger: Calling capture_electron_scenario on an Electron target binary where the EnableNodeCliInspectArguments fuse is disabled (e.g. Obsidian or production Electron distributions).
  • Previous behavior: PlaywrightElectronActiveProvider attempts to launch the binary with inspect flags. Playwright hangs for 60 seconds awaiting the DevTools connection, ultimately throwing a generic startup timeout error.
  • Expected behavior: PlaywrightElectronActiveProvider reads the binary's fuses prior to launch and returns an immediate AnalysisUnsupportedTargetError advising the caller to use passive CDP inspection (inspect_electron_page) or run against an unrestricted development binary. If the fuse state is unknown, missing, or unparseable, launch proceeds normally.

Change and scope

  • Added assertNodeCliInspectArgumentsSupported helper in src/browser/PlaywrightElectronActiveFuses.ts utilizing existing readElectronFuseImage.
  • Integrated pre-flight check into PlaywrightElectronActiveProvider.capture() before process baseline capture and launch.
  • Injected optional readFuseImage into PlaywrightElectronActiveProvider for isolated unit testing.
  • Documented target fuse prerequisites in docs/electron-observation.md.

Contribution scope: Not applicable (ordinary fix within existing provider boundaries).

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/browser/PlaywrightElectronActiveProvider.ts (provider pre-launch stage).
  • Contribution scope fit and linked maintainer decision: Not applicable.
  • CLI and MCP/tool-catalog contract: Unchanged schema; failure returns tagged AnalysisUnsupportedTargetError.
  • Provider, bridge, target-format, or platform compatibility: Cross-platform Electron (Mach-O, PE, ELF).
  • Evidence, artifact, provenance, or reconstruction contract: Refusal returns structured error without corrupting partial evidence.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): Fast-fail before launch prevents orphan processes and avoids unnecessary process supervisor tracking.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: None.

Expected effects:

  • 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:
    • Unit tests in src/browser/PlaywrightElectronActiveFuses.test.ts (8 tests covering disabled, enabled, unknown/missing wire, unparseable, Mach-O universal, Windows PE, Linux ELF, and AbortSignal cancellation).
    • Integration test in src/browser/PlaywrightElectronActiveProvider.test.ts (rejects active capture before launch when EnableNodeCliInspectArguments fuse is disabled).
  • Base reproduction or other evidence: On base eab789aed, calling capture on a fuse-disabled binary invoked launch() and timed out after 60s. With this change, launch() is never called and AnalysisUnsupportedTargetError is returned immediately.
  • User-visible CLI/MCP output (if applicable):
    AnalysisUnsupportedTargetError: Target binary disables the EnableNodeCliInspectArguments fuse; Node CLI inspector arguments are ignored and active scenario capture cannot attach.
  • Remaining proof gaps: None.

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 check:fast — 2/2 tasks passed (typecheck & lint clean).
  • npm run verify:module-boundaries — 1887 files checked, 0 violations.
  • npm run test:focused -- src/browser/PlaywrightElectronActiveFuses.test.ts src/browser/PlaywrightElectronActiveProvider.test.ts — 15/15 tests passed.
  • npm run verify:test-discovery — 1280 files discovered exactly once.
  • npm run docs:check — 6/6 tasks passed (docs & catalogs consistent).
  • npm run build:cached — 3/3 tasks passed (runtime bundle compiled cleanly).

Compatibility, safety, and release

  • Breaking changes or migration steps: None.
  • Real Hopper/Ghidra, browser, or OS coverage: Node v22.20.0 / Windows 11 host.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: Refusing execution when inspector arguments are disabled honors the target's explicit containment settings and prevents hanging background processes.

Author readiness

Human owner: @HarsH-1877

  • 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/3605 **Author:** [@HarsH-1877](https://github.com/HarsH-1877) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@baron](https://github.com/baron) **Base:** `main` ← **Head:** `fix/electron-inspect-arguments-fuse-3453` --- ### 📝 Commits (5) - [`2ed3f54`](https://github.com/morluto/rea/commit/2ed3f5474dac373397ca3653401025518d586a1f) feat(electron): add EnableNodeCliInspectArguments fuse pre-flight helper - [`bc32ee5`](https://github.com/morluto/rea/commit/bc32ee5277f0b0355941e5be0c1528653e78c224) fix(electron): reject active scenario capture when inspect fuse is disabled (#3453) - [`816dbd0`](https://github.com/morluto/rea/commit/816dbd0654a29e19e74d5cba3b13321946006880) docs(electron): document inspect fuse pre-flight refusal for scenario capture (#3453) - [`8b28b03`](https://github.com/morluto/rea/commit/8b28b03ea034dfaa5895a0ff53b4ebcee71ae5ef) test(electron): add PE, ELF, and abort-signal coverage for fuse pre-flight (#3453) - [`1369fcd`](https://github.com/morluto/rea/commit/1369fcdf1ce8551893c6c0f451d0214f551affec) fix(electron): resolve macOS framework binary and enforce startup deadline on fuse preflight (#3453) ### 📊 Changes **5 files changed** (+319 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/electron-observation.md` (+6 -0) ➕ `src/browser/PlaywrightElectronActiveFuses.test.ts` (+167 -0) ➕ `src/browser/PlaywrightElectronActiveFuses.ts` (+96 -0) 📝 `src/browser/PlaywrightElectronActiveProvider.test.ts` (+39 -1) 📝 `src/browser/PlaywrightElectronActiveProvider.ts` (+11 -0) </details> ### 📄 Description ## Summary Fixes #3453. In active Electron scenario capture (`capture_electron_scenario`), Playwright attaches to the target Electron main process using Node CLI inspect arguments (`--inspect=0` or `--remote-debugging-port=0`). When an Electron executable has the `EnableNodeCliInspectArguments` fuse explicitly disabled or removed, the runtime silently ignores inspection flags, causing Playwright to hang for the full 60-second startup deadline before timing out. This PR adds a pre-flight fuse inspection before process launch. If the executable explicitly disables or removes `EnableNodeCliInspectArguments`, `capture()` immediately fails fast with a typed `AnalysisUnsupportedTargetError` ("unsupported_target") without spawning processes or waiting for the startup deadline. ## Problem and expected behavior - **Trigger:** Calling `capture_electron_scenario` on an Electron target binary where the `EnableNodeCliInspectArguments` fuse is disabled (e.g. Obsidian or production Electron distributions). - **Previous behavior:** `PlaywrightElectronActiveProvider` attempts to launch the binary with inspect flags. Playwright hangs for 60 seconds awaiting the DevTools connection, ultimately throwing a generic startup timeout error. - **Expected behavior:** `PlaywrightElectronActiveProvider` reads the binary's fuses prior to launch and returns an immediate `AnalysisUnsupportedTargetError` advising the caller to use passive CDP inspection (`inspect_electron_page`) or run against an unrestricted development binary. If the fuse state is unknown, missing, or unparseable, launch proceeds normally. ## Change and scope - Added `assertNodeCliInspectArgumentsSupported` helper in `src/browser/PlaywrightElectronActiveFuses.ts` utilizing existing `readElectronFuseImage`. - Integrated pre-flight check into `PlaywrightElectronActiveProvider.capture()` before process baseline capture and launch. - Injected optional `readFuseImage` into `PlaywrightElectronActiveProvider` for isolated unit testing. - Documented target fuse prerequisites in `docs/electron-observation.md`. Contribution scope: Not applicable (ordinary fix within existing provider boundaries). ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/browser/PlaywrightElectronActiveProvider.ts` (provider pre-launch stage). - Contribution scope fit and linked maintainer decision: Not applicable. - CLI and MCP/tool-catalog contract: Unchanged schema; failure returns tagged `AnalysisUnsupportedTargetError`. - Provider, bridge, target-format, or platform compatibility: Cross-platform Electron (Mach-O, PE, ELF). - Evidence, artifact, provenance, or reconstruction contract: Refusal returns structured error without corrupting partial evidence. - Target selection, authority, upstream behavior, and cleanup details (if applicable): Fast-fail before launch prevents orphan processes and avoids unnecessary process supervisor tracking. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: None. Expected effects: - [x] Read existing files or captured data. - [x] Launch or attach to a process. - [x] Inject instrumentation or run scripts/code. - [x] Change process memory, registers, files, or configuration. - [x] Contact network services. - [x] Recover protected code or work around protections. - [x] Documentation or usability only; no target interaction. - [x] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: - Unit tests in `src/browser/PlaywrightElectronActiveFuses.test.ts` (8 tests covering disabled, enabled, unknown/missing wire, unparseable, Mach-O universal, Windows PE, Linux ELF, and AbortSignal cancellation). - Integration test in `src/browser/PlaywrightElectronActiveProvider.test.ts` (`rejects active capture before launch when EnableNodeCliInspectArguments fuse is disabled`). - Base reproduction or other evidence: On base `eab789aed`, calling capture on a fuse-disabled binary invoked `launch()` and timed out after 60s. With this change, `launch()` is never called and `AnalysisUnsupportedTargetError` is returned immediately. - User-visible CLI/MCP output (if applicable): `AnalysisUnsupportedTargetError: Target binary disables the EnableNodeCliInspectArguments fuse; Node CLI inspector arguments are ignored and active scenario capture cannot attach.` - Remaining proof gaps: None. 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 check:fast` — 2/2 tasks passed (typecheck & lint clean). - `npm run verify:module-boundaries` — 1887 files checked, 0 violations. - `npm run test:focused -- src/browser/PlaywrightElectronActiveFuses.test.ts src/browser/PlaywrightElectronActiveProvider.test.ts` — 15/15 tests passed. - `npm run verify:test-discovery` — 1280 files discovered exactly once. - `npm run docs:check` — 6/6 tasks passed (docs & catalogs consistent). - `npm run build:cached` — 3/3 tasks passed (runtime bundle compiled cleanly). ## Compatibility, safety, and release - Breaking changes or migration steps: None. - Real Hopper/Ghidra, browser, or OS coverage: Node v22.20.0 / Windows 11 host. - Package or release metadata impact: None. - Security, privacy, process, or containment review: Refusing execution when inspector arguments are disabled honors the target's explicit containment settings and prevents hanging background processes. ## Author readiness Human owner: @HarsH-1877 - [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-10-31 01:09:55 +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#5852
No description provided.