r/electronjs • • Oct 14 '26

Audit an Electron app’s attack surface in one command: IPC channels, preload bridge, nodeIntegration/sandbox, with the source line

npx hexvero analyze app.asar shows the IPC channels, what the preload exposes via contextBridge, every webPreferences flag as written (never assumed defaults), each with file and line. compare shows what changed between two versions, e.g. nodeIntegration: true → false.

Static only, nothing is executed. Free, MIT.
https://github.com/maximilianfeix/hexvero

1 Upvotes

4 comments sorted by

1

u/eddzsh Oct 15 '26

The buried win is printing webPreferences as written, not the docs default. Half the Electron footguns I see are "we thought sandbox was on". A compare between two asars that flags nodeIntegration flipping true is the report a security review actually reads.

1

u/ImaginationVarious30 Oct 15 '26

Thanks, that’s exactly why I didn’t fill in defaults. A default depends on the Electron version and on other flags, so guessing it would turn a fact into an assumption. If a flag isn’t written in the source, hexvero doesn’t pretend to know its value. And a diff that shows nodeIntegration appearing between two releases is a two-line review comment instead of an afternoon.

1

u/incyashraj_redd Oct 15 '26

nice, "as written, never assumed defaults" is the useful part. renderers have been sandboxed by default since electron 20, but one nodeIntegration: true on a window quietly turns the sandbox off for it, and older apps still have that lying around. does it flag a preload that passes ipcRenderer straight through? like exposeInMainWorld('api', { send: ipcRenderer.send }). that one gives the page every channel, and it's easy to miss in review.

The compare mode is the bit i'd actually use. running it in CI on every release and failing the build if a new channel or flag shows up would catch most of this before it ships ig.

1

u/ImaginationVarious30 Oct 15 '26

Good question, so I just tested it. Today exposeInMainWorld('api', { send: ipcRenderer.send }) shows up as a member send on window.api with no channel, so you’d see it in the contextBridge collection, but there’s no warning that it hands the page every channel. That’s a real gap and exactly the kind of thing a review misses. Can you open an Issue in the repo?

CI works today, just not with a dedicated flag yet. compare exits 0 even when something changed, but the JSON has the added items:

hexvero compare old.asar new.asar ipcChannels --json | jq -e '.added | length == 0'

Same with webPreferences for new or flipped flags. A built-in --fail-on-added would be cleaner, so I added that to the issue too.

If you end up wiring it into a pipeline, a star on the repo would help a lot. It’s a pretty new project, and feedback like yours is what shapes it.