Skip to content

Set Electron Fuses in the packaged app (#373) - #385

Merged
jtklein-agents merged 1 commit into
spec/370-electron-build-and-runtime-packages-currentfrom
373-set-electron-fuses-in-the-packaged-app
Nov 26, 2026
Merged

jtklein-agents merged 1 commit into
spec/370-electron-build-and-runtime-packages-currentfrom
373-set-electron-fuses-in-the-packaged-app

Conversation

@jtklein-agents

Copy link
Copy Markdown
Owner

Closes #373

Summary

electron-builder writes Electron Fuses into the packaged app. A pack test checks the exact block.

 "build": {
   "afterSign": "./scripts/notarize.js",
+  "electronFuses": {
+    "runAsNode": false,
+    "enableCookieEncryption": true,
+    "enableNodeOptionsEnvironmentVariable": false,
+    "enableNodeCliInspectArguments": false,
+    "enableEmbeddedAsarIntegrityValidation": true,
+    "onlyLoadAppFromAsar": true
+  },

Evidence

  • Before: the packaged app sets no fuses. ELECTRON_RUN_AS_NODE, NODE_OPTIONS and --inspect all work on it, and it loads an unchecked app.asar.
    After: yarn dist-pack, then npx @electron/fuses read --app dist/mac-arm64/raxmlGUI.app (macOS arm64):

    RunAsNode is Disabled
    EnableCookieEncryption is Enabled
    EnableNodeOptionsEnvironmentVariable is Disabled
    EnableNodeCliInspectArguments is Disabled
    EnableEmbeddedAsarIntegrityValidation is Enabled
    OnlyLoadAppFromAsar is Enabled
    

    The packed app ran for 20 s with no errors until it was stopped.

  • New test in src/pack.test.ts: expect( build.electronFuses ).toEqual( { …the six fuses… } ) fails if a fuse is added, dropped or changed.

  • yarn test 475/475, app e2e 4/4 (still launches out/main/index.js on the dev Electron, which has no fuses), lint and typecheck clean on macOS. Ubuntu and Windows are covered by CI only.

Not covered: the repo has no yarn verify script, so lint + typecheck + yarn test stand in for it. No CI job packs the app or reads its fuses. A fused Windows, Linux or universal-mac build has not been launched; the parent spec leaves that to the release-candidate check.

Merge Danger

Door: two-way

Removing the block brings back the unfused build. An app a user has already installed keeps its fuses until it updates.

Blast Radius: packaged-app startup

If onlyLoadAppFromAsar or the asar integrity check doesn't hold on some platform's packed build, that build won't start. Dev runs and e2e are unaffected.

🤖 Generated with Claude Code

electron-builder sets six fuses through build.electronFuses: no
RunAsNode, no NODE_OPTIONS, no Node inspect flags, cookie encryption on,
and the app loads only from an asar that passes integrity validation.
A pack test asserts the exact block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtklein-agents
jtklein-agents merged commit 279c601 into spec/370-electron-build-and-runtime-packages-current Nov 26, 2026
10 of 12 checks passed
@jtklein-agents
jtklein-agents deleted the 373-set-electron-fuses-in-the-packaged-app branch November 26, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant