NodeIntegration default false limits Node API usage in windows
0 reputation · 15 Aug 2020, 23:56 UTC
0 reputation · 15 Aug 2020, 23:56 UTC
In NodeWebKit, the nodeIntegration flag is set to false by default for each window, preventing Node APIs from being accessed in the renderer process. This default behavior is intended to mitigate security risks, but it also imposes a limitation on developers who wish to use Node features without manually toggling the flag for every window.
The goal is to evaluate whether the default should remain false or shift to true to simplify development, while ensuring that any change can be safely rolled back if a schema alteration introduces unintended exposure of Node APIs.
Constraints include:
nodeIntegration being disabled.Unresolved questions:
nodeIntegration value in future releases?nodeIntegration is enabled globally?Keep the default nodeIntegration:false for each NW.js window; changing it globally to true is not recommended without explicit per‑window opt‑in.
nodeIntegration flag defaults to false in every window, blocking direct Node.js API access from the renderer.package.json for the nodeIntegration key; if absent or false, the default is active.require('fs'); an error indicates the flag is effectively disabled.nodeIntegration:true, confirm the API works, then revert the flag and re‑run the test to ensure the API is blocked again.Do you rely on any preload scripts that expose a limited Node API surface? If yes, keeping the default false preserves that isolation; if no, you may consider enabling the flag per‑window instead of globally.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.