8000 chore: enable v2 sandbox on mac by nornagon · Pull Request #15647 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: enable v2 sandbox on mac #15647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,9 @@ if (is_mac) {
output_name = electron_helper_name
deps = [
":electron_framework+link",
"//sandbox/mac:seatbelt",
]
defines = [ "HELPER_EXECUTABLE" ]
sources = filenames.app_sources
include_dirs = [ "." ]
info_plist = "atom/renderer/resources/mac/Info.plist"
Expand All @@ -632,6 +634,12 @@ if (is_mac) {
"-rpath",
"@executable_path/../../..",
]
if (is_component_build) {
ldflags += [
"-rpath",
"@executable_path/../../../../../..",
]
}
}

bundle_data("electron_app_framework_bundle_data") {
Expand Down
35 changes: 35 additions & 0 deletions atom/app/atom_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "atom/app/atom_main.h"

#include <cstdlib>
#include <memory>
#include <vector>

#if defined(OS_WIN)
Expand All @@ -30,6 +31,7 @@
#include "atom/app/atom_main_delegate.h" // NOLINT
#include "content/public/app/content_main.h"
#else // defined(OS_LINUX)
#include <mach-o/dyld.h>
#include <unistd.h>
#include <cstdio>
#include "atom/app/atom_library_main.h"
Expand All @@ -41,6 +43,10 @@
#include "base/i18n/icu_util.h"
#include "electron/buildflags/buildflags.h"

#if defined(HELPER_EXECUTABLE)
#include "sandbox/mac/seatbelt_exec.h" // nogncheck
#endif // defined(HELPER_EXECUTABLE)

namespace {

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
Expand Down Expand Up @@ -207,6 +213,35 @@ int main(int argc, char* argv[]) {
}
#endif

#if defined(HELPER_EXECUTABLE)
uint32_t exec_path_size = 0;
int rv = _NSGetExecutablePath(NULL, &exec_path_size);
if (rv != -1) {
fprintf(stderr, "_NSGetExecutablePath: get length failed\n");
abort();
}

std::unique_ptr<char[]> exec_path(new char[exec_path_size]);
rv = _NSGetExecutablePath(exec_path.get(), &exec_path_size);
if (rv != 0) {
fprintf(stderr, "_NSGetExecutablePath: get path failed\n");
abort();
}
sandbox::SeatbeltExecServer::CreateFromArgumentsResult seatbelt =
sandbox::SeatbeltExecServer::CreateFromArguments(exec_path.get(), argc,
argv);
if (seatbelt.sandbox_required) {
if (!seatbelt.server) {
fprintf(stderr, "Failed to create seatbelt sandbox server.\n");
abort();
}
if (!seatbelt.server->InitializeSandbox()) {
fprintf(stderr, "Failed to initialize sandbox.\n");
abort();
}
}
#endif

return AtomMain(argc, argv);
}

Expand Down
7 changes: 0 additions & 7 deletions atom/browser/atom_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ void AtomBrowserMainParts::InitializeFeatureList() {
cmd_line->GetSwitchValueASCII(::switches::kEnableFeatures);
auto disable_features =
cmd_line->GetSwitchValueASCII(::switches::kDisableFeatures);
#if defined(OS_MACOSX)
// Disable the V2 sandbox on macOS.
// Chromium is going to use the system sandbox API of macOS for the sandbox
// implmentation, we may have to deprecate --mixed-sandbox for macOS once
// Chromium drops support for the old sandbox implmentation.
disable_features += std::string(",") + features::kMacV2Sandbox.name;
#endif
// Disable creation of spare renderer process with site-per-process mode,
// it interferes with our process preference tracking for non sandboxed mode.
// Can be reenabled when our site instance policy is aligned with chromium
Expand Down
1 change: 0 additions & 1 deletion patches/common/chromium/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,5 @@ customizable_app_indicator_id_prefix.patch
cross_site_document_resource_handler.patch
content_allow_embedder_to_prevent_locking_scheme_registry.patch
fix_trackpad_scrolling.patch
mac_fix_form_control_rendering_on_10_14_mojave.patch
support_mixed_sandbox_with_zygote.patch
disable_color_correct_rendering.patch

This file was deleted.

0