Disable Networking in Electron
Asked Answered
B

1

14

electron.js is a user interface toolkit that allows a web application to operate as an arbitrary GUI.

However, there are some applications that should be considered sensitive - for instance, a GUI for banking should have strong assurances that it's not doing anything mischievous.

I'm wondering if the electron executable (or node.js itself) would allow operation in a mode where networking is outright disabled - that way, as a consumer, I can at least be confident a user interface isn't sending my password off-site.

Something like ./node_modules/.bin/electron --no-networking index.js would be very convenient, albeit a far cry.

Befall answered 23/12, 2017 at 14:53 Comment(2)
Great question! Did you end up finding a solution to reliably disable networking capabilities in Electron app?Flatwise
See electronjs.org/docs/latest/tutorial/…Flatwise
K
0

I haven't tried whether it works or not. The following lines simulate the offline mode in chromium.

// To emulate a network outage.

window.webContents.session.enableNetworkEmulation({ offline: true });
Kelula answered 29/11, 2021 at 6:5 Comment(1)
Not 100% sure but I think I have seen an open WebSocket connection exchange messages even when network emulation was enabled, so maybe it's not 100% fool-proof.Barrick

© 2022 - 2024 — McMap. All rights reserved.