Draw the renderer to native path

List every BrowserWindow, embedded remote surface, preload script and native operation exposed to it. Identify where content originates and where navigation can take it. A window that normally displays a local page can still encounter untrusted input through links, HTML rendering or third-party resources.

Review current Electron security guidance for isolation, sandboxing and Node integration with your supported release. Configuration defaults can change; make the intended boundary explicit in the application. Keep remote content away from privileged Node-enabled contexts and update the framework through a controlled compatibility process.

Expose an operation, not a transport

Design a small preload API for each necessary task. A method such as chooseExportDestination has a narrower contract than exposing unrestricted send or invoke primitives to the renderer. Do not pass IPC event objects into untrusted callbacks, where they may reveal more authority than the caller needs.

In the main process, validate the sender frame and expected origin or equivalent trusted source. Then validate argument shape, size, allowed resource and operation permissions. A valid sender does not make an arbitrary filesystem path safe, and a well-formed argument does not authenticate the sender.

Use negative tests at the boundary

For an owned test app, attempt calls from an unexpected frame, after navigation and with malformed arguments. Exercise path traversal, overlong strings and requests for resources outside the intended scope. These are application boundary tests; they should never operate on unrelated user files.

Also test legitimate failure handling. If an export is cancelled or an expected file is absent, the main process should return a controlled error rather than falling back to a broader operation. Keep sensitive paths and user data out of renderer-visible stack traces and routine logs.

Separate code exposure from native privilege

ASAR packaging is not encryption, and the renderer code needed by customers remains inspectable. Source-map policy, release exposure screening and native permission design address different properties. A tool that confuses an analyzer does not establish that a compromised renderer cannot abuse an exposed API.

Use Electron supported packaging and signing sequence after the boundary changes. Exercise startup, deep links, updates and representative platform features. Retain private diagnostics and verify the final package identity with native tools.

CloneGuard can guide these checks and inventory the outer artifact, but its generic scanner marks ASAR contents unassessed. Use authorized Electron tooling to inspect an isolated copy where needed, and report that additional inspection separately from the bounded scanner result.

Practical checklist

  • Map all renderer, preload and main entry points.
  • Expose only task-specific APIs.
  • Validate sender, argument and resource authorization.
  • Exercise negative cases and legitimate error handling.

Sources and further reading

Primary references support the technical details. Procedures here are guidance; only explicitly recorded project results describe tests we ran.

  1. Electron: Security

Prepared with AI assistance. How this library is produced. Suggest a correction; keep private code and credentials out of public issues.