You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chromium finished moving to Aperitif in CL 8620834 (crbug.com/40794783). It removed the kAperitifHelpers feature and the Helper (Aperitif*) bundles. Electron was already turning that feature off, so the roll needed only a compile fix (removing features::kAperitifHelpers from shell/browser/feature_list_mac.mm). Electron's helpers work exactly as before, but they still start the sandbox in main(). By then, Electron Framework's startup code and every system library's startup code have already run unsandboxed. Chromium's libaperitif.dylib starts the sandbox earlier, from its own startup code, which runs before the framework loads.
Goal: start the sandbox in Electron's helper processes before any code from Electron Framework or system libraries runs. Helper names and child-process launch paths stay the same.
Not in scope at first: MAS builds and the main Electron executable (see Phase 4).
Phase 0: check that it can work (prototype, nothing lands)
Library validation. This is what stopped Chromium in 2022: macOS refused @-path library loading when library validation was off (crbug.com/40794783#comment19). Build one prototype helper linked to libaperitif and run it twice: signed with hardened runtime, and signed with com.apple.security.cs.disable-library-validation (common in apps that load native modules). Confirm both start and run sandboxed on the oldest and newest supported macOS versions.
Load order. Run otool -L on the prototype helper. libaperitif.dylib must be listed before Electron Framework. Electron currently links the framework with -framework (electron_framework_link_config in BUILD.gn). Chromium's comment says the Apple link rule puts -framework entries before all shared libraries, so the order will come out wrong.
Phase 1: build changes (BUILD.gn)
Add the dependency. Add //content/public/app:aperitif to the electron_helper_app template (non-MAS only).
Fix the load order. Preferred: link the framework binary as an explicit input placed after libaperitif, keeping the fix that stops every framework relink from rebuilding the helpers' objects (electron_framework_link). Fallback: switch the helpers to :electron_framework+link_nested, as Chrome does, and accept the extra rebuilds.
Fix the library's install path. Chromium hard-codes @executable_path/../Frameworks/<Chromium> Framework.framework/Versions/<version>/Libraries/libaperitif.dylib. That doesn't match Electron's layout: Electron's helpers live in Electron.app/Contents/Frameworks/, and the framework version folder is A. Add an installnametool,-change rewrite in the helper's link flags (as is already done for libffmpeg.dylib) so the helper loads @rpath/Electron Framework.framework/Libraries/libaperitif.dylib. Check component builds, which already use @rpath/libaperitif.dylib.
Bundle the library. Add libaperitif.dylib to bundle_data("electron_framework_libraries") so it ships in Electron Framework.framework/Versions/A/Libraries/.
Remove the old dependency. Drop //sandbox/mac:seatbelt from the helper's direct dependencies; libaperitif brings it in.
Phase 2: helper entry point (shell/app/electron_main_mac.cc)
Remove the code that moves into libaperitif. Delete the _NSGetExecutablePath / SeatbeltExecServer block from main(). Add a __attribute__((constructor)) that calls AperitifCheckInitialized(), as chrome/app/chrome_exe_main_mac.c does.
Recheck what now runs after the sandbox is on:
FixStdioStreams() may open /dev/null inside an already-sandboxed process. Confirm the sandbox rules allow it, or that the browser always passes valid stdio so it isn't needed.
ELECTRON_RUN_AS_NODE and the --type check: the sandbox only starts when seatbelt arguments are present, so both should behave as today. Add tests to prove it.
Optional: convert the helper to plain C to make it smaller. Low priority, since Electron's helpers are already small next to the framework.
Phase 3: packaging, signing, release
Zip manifests. Add Versions/A/Libraries/libaperitif.dylib to script/zip_manifests/dist_zip.mac.{arm64,x64}.manifest.
Signing: confirm @electron/osx-sign signs the new dylib and that notarization passes.
Universal builds: confirm @electron/universal merges the arm64 and x64 copies.
Downstream packagers: test with Electron Forge and electron-builder.
Phase 4: follow-ups (each a separate PR)
MAS builds: decide whether they adopt libaperitif. They skip seatbelt today.
Main executable: Chrome also switched its main executable (CL 8519057). For Electron the only gain would be early EarlyMallocZoneRegistration(), since the browser process isn't sandboxed. Measure before deciding.
Testing
Build check: like Chromium's verify_dynamic_libraries, a script that asserts each helper's otool -L lists exactly libaperitif, then Electron Framework, then libSystem, in that order.
Specs:
Sandboxed renderers and the utility and GPU processes start.
child_process.fork() with the runAsNode fuse on and off still works.
An app signed without library validation can load a native module.
Manual: compare memory per renderer and renderer startup time before and after. Chromium reported about 10 MB less per process and roughly 10% faster renderer startup. Electron already links its framework directly, so expect a smaller gain. The main goal is the sandbox ordering.
Risks
Risk
Mitigation
Apps that disable library validation can't load libaperitif (the 2022 blocker)
Phase 0 test; stop if it fails
-framework link order puts the framework before libaperitif
Phase 1 load-order fix, plus the otool -L build check
Code that now runs after the sandbox starts (stdio fix) hits sandbox denials
On the right path but would like to see some improvements before landing #55962
Replace the C++ launcher with a thin C entry point for the browser and helpers. That removes duplicated libc++ code. Keep run-as-node fuse handling etc in the framework.
Keep +link_nested, but give the dylib an electron native install name instead of rewriting Chrome’s. Reuse chromium’s seatbelt code and repair stdio before applying the sandbox.
MAS doesn’t need Seatbelt, but EarlyMallocZoneRegistration must run once, before the framework’s allocator constructor.
Also, keep the Mach-O link order check but locally or CI, launch a build with DYLD_PRINT_INITIALIZERS=1 open a sandboxed window, in both browser and renderer, confirm apertif dylib initializes before framework.
Activity
jkleinsc commentedon Nov 19, 2026
Proposed plan: move macOS helpers to Aperitif
Chromium finished moving to Aperitif in CL 8620834 (crbug.com/40794783). It removed the
kAperitifHelpersfeature and theHelper (Aperitif*)bundles. Electron was already turning that feature off, so the roll needed only a compile fix (removingfeatures::kAperitifHelpersfromshell/browser/feature_list_mac.mm). Electron's helpers work exactly as before, but they still start the sandbox inmain(). By then, Electron Framework's startup code and every system library's startup code have already run unsandboxed. Chromium'slibaperitif.dylibstarts the sandbox earlier, from its own startup code, which runs before the framework loads.Goal: start the sandbox in Electron's helper processes before any code from Electron Framework or system libraries runs. Helper names and child-process launch paths stay the same.
Not in scope at first: MAS builds and the main
Electronexecutable (see Phase 4).Phase 0: check that it can work (prototype, nothing lands)
@-path library loading when library validation was off (crbug.com/40794783#comment19). Build one prototype helper linked tolibaperitifand run it twice: signed with hardened runtime, and signed withcom.apple.security.cs.disable-library-validation(common in apps that load native modules). Confirm both start and run sandboxed on the oldest and newest supported macOS versions.otool -Lon the prototype helper.libaperitif.dylibmust be listed beforeElectron Framework. Electron currently links the framework with-framework(electron_framework_link_configinBUILD.gn). Chromium's comment says the Apple link rule puts-frameworkentries before all shared libraries, so the order will come out wrong.Phase 1: build changes (
BUILD.gn)//content/public/app:aperitifto theelectron_helper_apptemplate (non-MAS only).electron_framework_link). Fallback: switch the helpers to:electron_framework+link_nested, as Chrome does, and accept the extra rebuilds.@executable_path/../Frameworks/<Chromium> Framework.framework/Versions/<version>/Libraries/libaperitif.dylib. That doesn't match Electron's layout: Electron's helpers live inElectron.app/Contents/Frameworks/, and the framework version folder isA. Add aninstallnametool,-changerewrite in the helper's link flags (as is already done forlibffmpeg.dylib) so the helper loads@rpath/Electron Framework.framework/Libraries/libaperitif.dylib. Check component builds, which already use@rpath/libaperitif.dylib.libaperitif.dylibtobundle_data("electron_framework_libraries")so it ships inElectron Framework.framework/Versions/A/Libraries/.//sandbox/mac:seatbeltfrom the helper's direct dependencies; libaperitif brings it in.Phase 2: helper entry point (
shell/app/electron_main_mac.cc)_NSGetExecutablePath/SeatbeltExecServerblock frommain(). Add a__attribute__((constructor))that callsAperitifCheckInitialized(), aschrome/app/chrome_exe_main_mac.cdoes.FixStdioStreams()may open/dev/nullinside an already-sandboxed process. Confirm the sandbox rules allow it, or that the browser always passes valid stdio so it isn't needed.ELECTRON_RUN_AS_NODEand the--typecheck: the sandbox only starts when seatbelt arguments are present, so both should behave as today. Add tests to prove it.Phase 3: packaging, signing, release
Versions/A/Libraries/libaperitif.dylibtoscript/zip_manifests/dist_zip.mac.{arm64,x64}.manifest.@electron/osx-signsigns the new dylib and that notarization passes.@electron/universalmerges the arm64 and x64 copies.Phase 4: follow-ups (each a separate PR)
EarlyMallocZoneRegistration(), since the browser process isn't sandboxed. Measure before deciding.Testing
verify_dynamic_libraries, a script that asserts each helper'sotool -Llists exactly libaperitif, then Electron Framework, then libSystem, in that order.child_process.fork()with therunAsNodefuse on and off still works.Risks
-frameworklink order puts the framework before libaperitifotool -Lbuild checkdeepak1556 commentedon Nov 20, 2026
On the right path but would like to see some improvements before landing #55962
+link_nested, but give the dylib an electron native install name instead of rewriting Chrome’s. Reuse chromium’s seatbelt code and repair stdio before applying the sandbox.EarlyMallocZoneRegistrationmust run once, before the framework’s allocator constructor.Also, keep the Mach-O link order check but locally or CI, launch a build with
DYLD_PRINT_INITIALIZERS=1open a sandboxed window, in both browser and renderer, confirm apertif dylib initializes before framework.