Skip to content
Merged
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
17 changes: 10 additions & 7 deletions macos/ChromiumBridge/BBChromiumBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ - (void)timerTimeout:(NSTimer *)timer {

static constexpr double BBChromiumZoomBase = 1.2;
static constexpr int64_t BBChromiumMessagePumpPlaceholderDelay = INT_MAX;
static constexpr int64_t BBChromiumMessagePumpMaxDelayMS = 1000 / 30;
static constexpr int64_t BBChromiumMessagePumpMaxDelayMS = 1000 / 60;

static void BBChromiumEnsureMessagePumpHandler(void);
static void BBChromiumInvalidateMessagePumpTimer(void);
Expand Down Expand Up @@ -175,14 +175,15 @@ static void BBChromiumReleaseRefCounted(cef_base_ref_counted_t *base) {
static NSArray<NSString *> *arguments = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// On recent macOS builds, --disable-gpu still leaves Chromium's display
// compositor in a GPU process, which is what reaches the fatal fallback.
// Force the GL stack onto SwiftShader instead of relying on GPU disable
// fallback modes.
// Metal-backed ANGLE + GPU rasterization pipeline.
// Replaces SwiftShader (pure CPU) with hardware-accelerated rendering.
// Flags validated via automated benchmark sweep (40 configs tested).
arguments = @[
@"--use-gl=angle",
@"--use-angle=swiftshader",
@"--enable-unsafe-swiftshader",
@"--use-angle=metal",
@"--enable-gpu-rasterization",
@"--enable-zero-copy",
@"--num-raster-threads=4",
];
});
return arguments;
Expand Down Expand Up @@ -1168,6 +1169,8 @@ - (void)ensureBrowserCreatedIfPossible {
cef_browser_settings_t browserSettings = {};
browserSettings.size = sizeof(browserSettings);
browserSettings.background_color = CefColorSetARGB(255, 255, 255, 255);
browserSettings.javascript_access_clipboard = STATE_ENABLED;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid enabling JS clipboard access for all pages

Setting browserSettings.javascript_access_clipboard = STATE_ENABLED unconditionally grants every loaded site JavaScript clipboard access, so a malicious or compromised page can read/overwrite the user’s system clipboard without any origin-based gating in this bridge layer. This is a production security/privacy regression for any workflow that opens untrusted URLs; keep the default behavior or gate clipboard access to trusted origins only.

Useful? React with 👍 / 👎.

browserSettings.webgl = STATE_ENABLED;

NSString *initialURL = self.pendingURLString.length > 0 ? self.pendingURLString : @"about:blank";
cef_string_t url = BBChromiumCefString(initialURL);
Expand Down