Skip to content

Commit 2cec6d2

Browse files
ccups101claude
andcommitted
Remove the index.html integrity "workaround" (no such Electron gap)
bf33dba added `fs.readFileSync(index.html)` before loadFile, with a comment saying Electron 44's asar-integrity check skipped the main-frame load of index.html. That observation was wrong. A separate investigation (two independent builds, fuse wire read back from each exe, exe/asar header hash verified before every run) found a tampered index.html is rejected with or without the extra read (asar_file_validator.cc), in a minimal app and in NoteForge HEAD with the line stripped. The likely cause of the original result was a stale build artifact in the test setup. Drops the line and the comment so the repo no longer asserts a non-existent Electron bug, and corrects the 2.8.0 CHANGELOG note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d82d024 commit 2cec6d2

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versio
55

66
## [Unreleased]
77

8+
### Fixed
9+
- Removed a startup read of `index.html` added in 2.8.0 as a workaround for an Electron asar-integrity gap. The gap doesn't exist: a separate investigation found Electron 44 does validate `index.html` loaded from the asar (tampered copies are rejected with or without the read). The 2.8.0 note below is corrected accordingly.
10+
811
## [2.8.0] — 2026-10-08
912

1013
Audit pass. Every fix below was reproduced against 2.7.2 first and has a regression test that fails on the old code.
@@ -24,7 +27,7 @@ Audit pass. Every fix below was reproduced against 2.7.2 first and has a regress
2427
- **The renderer can no longer turn off its own sandbox** through `set-config`, and config values are type-checked. Editing `noteforge-config.json` by hand still works.
2528
- **Restore only installs the file the user picked**, and re-checks its format (v2, scrypt, minimum N) right before installing it.
2629
- **scrypt `r` and `p` are capped (≤ 32, ≤ 16), and N/r/p must be integers.** A crafted header could otherwise make `scryptSync` block the main process for hours.
27-
- **Electron fuses on the packaged app:** no RunAsNode, no `NODE_OPTIONS`, no `--inspect`. Embedded asar integrity is on, and `index.html` is read through the integrity check before it loads.
30+
- **Electron fuses on the packaged app:** no RunAsNode, no `NODE_OPTIONS`, no `--inspect`. Embedded asar integrity is on.
2831
- Bundled DOMPurify 3.3.3 → 3.4.16 (mXSS fixes from 3.4.0, later hardening).
2932
- Electron 33 → 44 (Chromium security fixes; 33 has been end-of-life since mid-2025). electron-builder 25 → 26, electron-updater 6.3 → 6.8.
3033

‎main.js‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -745,11 +745,6 @@ function createWindow() {
745745
session.defaultSession.setPermissionRequestHandler((_wc, _perm, cb) => cb(false));
746746

747747
if (ws.maximized) mainWindow.maximize();
748-
// With the embedded-asar-integrity fuse on (package.json build.electronFuses), Node-side
749-
// reads from app.asar are hash-checked, but on Electron 44 the main-frame load of
750-
// index.html was not: a tampered index.html (which carries the CSP) loaded fine.
751-
// Reading it through fs first makes a tampered copy fail the check before it's shown.
752-
if (app.isPackaged) fs.readFileSync(path.join(__dirname, "index.html"));
753748
mainWindow.loadFile("index.html");
754749
mainWindow.once("ready-to-show", () => mainWindow.show());
755750

0 commit comments

Comments
 (0)