GeezerVison is showing github.com — Merge remote-tracking branch 'origin/dev' into browser-settings/impor… · anomalyco/opencode-rune@50b4d9d
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/browser-engine/src/bin/opencode_browser_engine_helper.rs +30-1Lines changed: 30 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,10 +23,12 @@ const CHILD_FRAME_LOCKDOWN_APIS: &[&str] = &[ | 23 | 23 | "pageAction", | 24 | 24 | "contextMenus", | 25 | 25 | "webNavigation", | | 26 | + "downloads", | | 27 | + "management", | 26 | 28 | ]; | 27 | 29 |
| 28 | 30 | const CHILD_FRAME_V8_LOCKDOWN_JS: &str = r#"(function(){ | 29 | | - var apis = ["tabs","windows","action","browserAction","pageAction","contextMenus","webNavigation"]; | | 31 | + var apis = ["tabs","windows","action","browserAction","pageAction","contextMenus","webNavigation","downloads","management"]; | 30 | 32 | var roots = ["chrome","browser"]; | 31 | 33 | for (var r = 0; r < roots.length; r++) { | 32 | 34 | var root; | @@ -42,6 +44,22 @@ const CHILD_FRAME_V8_LOCKDOWN_JS: &str = r#"(function(){ | 42 | 44 | }); | 43 | 45 | } catch (e) {} | 44 | 46 | } | | 47 | + try { | | 48 | + var rt = root.runtime; | | 49 | + if (rt && typeof rt === "object") { | | 50 | + var nms = ["connectNative","sendNativeMessage"]; | | 51 | + for (var j = 0; j < nms.length; j++) { | | 52 | + try { | | 53 | + Object.defineProperty(rt, nms[j], { | | 54 | + value: undefined, | | 55 | + configurable: false, | | 56 | + enumerable: false, | | 57 | + writable: false | | 58 | + }); | | 59 | + } catch (e) {} | | 60 | + } | | 61 | + } | | 62 | + } catch (e) {} | 45 | 63 | } | 46 | 64 | })();"#; | 47 | 65 |
| @@ -110,6 +128,17 @@ fn lockdown_extension_child_frame( | 110 | 128 | let _ = root.set_value_bykey(Some(&key), Some(&mut undef), locked.clone()); | 111 | 129 | } | 112 | 130 | } | | 131 | + if let Some(rt) = root.value_bykey(Some(&CefString::from("runtime"))) | | 132 | + && rt.is_object() != 0 | | 133 | + { | | 134 | + for nm in ["connectNative", "sendNativeMessage"] { | | 135 | + let key = CefString::from(nm); | | 136 | + let _ = rt.delete_value_bykey(Some(&key)); | | 137 | + if let Some(mut undef) = cef::v8_value_create_undefined() { | | 138 | + let _ = rt.set_value_bykey(Some(&key), Some(&mut undef), locked.clone()); | | 139 | + } | | 140 | + } | | 141 | + } | 113 | 142 | } | 114 | 143 | } | 115 | 144 | let mut retval = None; | |
Collapse file Copy file name to clipboardExpand all lines: apps/browser-engine/src/cdp_ledger.rs +14-5Lines changed: 14 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -437,6 +437,7 @@ wrap_dev_tools_message_observer! { | 437 | 437 | cdp_ledger: Arc<Mutex<crate::cdp_ledger::EngineCdpLedger>>, | 438 | 438 | passkeys: Arc<crate::passkeys::TabPasskeyGate>, | 439 | 439 | media_gate: Arc<crate::media_gate::TabMediaGate>, | | 440 | + context_ready: Arc<std::sync::atomic::AtomicBool>, | 440 | 441 | prompt_shared: crate::prompts::PromptShared, | 441 | 442 | input_guard: Arc<Mutex<crate::input_guard::InputGuard>>, | 442 | 443 | emulation_scale: Arc<std::sync::atomic::AtomicU32>, | @@ -808,7 +809,7 @@ wrap_dev_tools_message_observer! { | 808 | 809 | obs.send.extend(pk_send); | 809 | 810 | let (mg_consumed, mg_ask) = self.media_gate.observe_event(&method, ¶ms, session_id.as_deref()); | 810 | 811 | if let Some(ask) = mg_ask { | 811 | | - if let Some(deny) = self.hold_media_ask(ask) { | | 812 | + if let Some(deny) = self.hold_media_ask(browser.as_deref(), ask) { | 812 | 813 | obs.send.push(deny); | 813 | 814 | } | 814 | 815 | } | @@ -897,10 +898,19 @@ impl TabCdpObserver { | 897 | 898 | /// Holds a gated `getUserMedia` for the bar, or returns the deny answer to send at once: a | 898 | 899 | /// preview tab, prompts off, an unknown or insecure context, or an embedded frame of another | 899 | 900 | /// origin (the same rules as `TabPermissionHandler::on_request_media_access_permission`). | 900 | | - fn hold_media_ask(&self, ask: crate::media_gate::MediaAsk) -> Option<String> { | 901 | | - let top = crate::prompts::origin_of(&self.snap.lock().unwrap().url); | | 901 | + fn hold_media_ask(&self, browser: Option<&Browser>, ask: crate::media_gate::MediaAsk) -> Option<String> { | | 902 | + // The live main frame, as `on_request_media_access_permission` reads it: the snapshot can | | 903 | + // lag a navigation that just committed. | | 904 | + let live = browser | | 905 | + .and_then(cef::ImplBrowser::main_frame) | | 906 | + .map(|f| cef::CefString::from(&cef::ImplFrame::url(&f)).to_string()); | | 907 | + let top = live | | 908 | + .filter(|u| !u.trim().is_empty()) | | 909 | + .or_else(|| Some(self.snap.lock().unwrap().url.clone())) | | 910 | + .and_then(|u| crate::prompts::origin_of(&u)); | 902 | 911 | let origin = ask.origin.as_deref().and_then(crate::prompts::origin_of); | 903 | 912 | let ok = !self.is_preview | | 913 | + && self.context_ready.load(std::sync::atomic::Ordering::Acquire) | 904 | 914 | && self.prompt_shared.enabled.load(std::sync::atomic::Ordering::Relaxed) | 905 | 915 | && origin.is_some() | 906 | 916 | && origin == top | @@ -915,8 +925,7 @@ impl TabCdpObserver { | 915 | 925 | kinds: ask.kinds, | 916 | 926 | is_media: true, | 917 | 927 | }; | 918 | | - self.prompts.hold_media_gate(self.tab_id, prompt, ask.allow_msg, ask.deny_msg, &self.out_tx); | 919 | | - None | | 928 | + self.prompts.hold_media_gate(self.tab_id, prompt, ask.allow_msg, ask.deny_msg, &self.out_tx) | 920 | 929 | } | 921 | 930 |
| 922 | 931 | fn surface(&self, browser: Option<&Browser>) -> crate::engine::Surface { | |
Collapse file Copy file name to clipboardExpand all lines: apps/browser-engine/src/context.rs +55-8Lines changed: 55 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,7 +47,7 @@ use std::sync::{Arc, Mutex}; | 47 | 47 | use cef::rc::Rc as _; | 48 | 48 | use cef::{ | 49 | 49 | Browser, Callback, CefString, CompletionCallback, Frame, ImplCompletionCallback, | 50 | | - ImplCookieManager, ImplDictionaryValue, ImplPreferenceManager, ImplRequest, | | 50 | + ImplCookieManager, ImplDictionaryValue, ImplListValue, ImplPreferenceManager, ImplRequest, | 51 | 51 | ImplRequestContext, ImplRequestContextHandler, ImplResourceRequestHandler, ImplValue, Request, | 52 | 52 | RequestContext, RequestContextHandler, RequestContextSettings, ResourceRequestHandler, | 53 | 53 | Response, ReturnValue, WrapCompletionCallback, WrapRequestContextHandler, | @@ -669,14 +669,43 @@ pub fn disallow_extension_file_access(ext_id: &str, normalized_path: &str) -> bo | 669 | 669 | ctx.set_preference(Some(&key), Some(&mut val), Some(&mut err)) != 0 | 670 | 670 | } | 671 | 671 |
| 672 | | -/// Post-load fail-closed verification (`review-rd274.md` Round-3 §1a): reads back Chromium's | 673 | | -/// persisted `extensions.settings.<loaded_id>` after `Extensions.loadUnpacked` succeeds and | 674 | | -/// requires BOTH: | | 672 | +/// Defense-in-depth browser-process lockdown of Chromium native messaging preferences on the | | 673 | +/// global `CefRequestContext` (`native_messaging.blocklist = ["*"]`, empty allowlist, user-level | | 674 | +/// hosts disabled). Runs alongside C++ `PermissionsData` stripping of `nativeMessaging`. | | 675 | +pub fn lockdown_global_native_messaging() { | | 676 | + let Some(ctx) = cef::request_context_get_global_context() else { | | 677 | + return; | | 678 | + }; | | 679 | + let set_list = |name: &str, items: &[&str]| { | | 680 | + let key = CefString::from(name); | | 681 | + if ctx.has_preference(Some(&key)) == 0 || ctx.can_set_preference(Some(&key)) == 0 { | | 682 | + return; | | 683 | + } | | 684 | + let Some(mut list) = cef::list_value_create() else { return }; | | 685 | + for (i, item) in items.iter().enumerate() { | | 686 | + list.set_string(i, Some(&CefString::from(*item))); | | 687 | + } | | 688 | + let Some(mut val) = cef::value_create() else { return }; | | 689 | + val.set_list(Some(&mut list)); | | 690 | + let mut err = CefString::from(" "); | | 691 | + let _ = ctx.set_preference(Some(&key), Some(&mut val), Some(&mut err)); | | 692 | + }; | | 693 | + set_list("native_messaging.blocklist", &["*"]); | | 694 | + set_list("native_messaging.allowlist", &[]); | | 695 | + let _ = set_optional_bool_pref(&ctx, "native_messaging.user_level_hosts", false); | | 696 | +} | | 697 | + | | 698 | +/// Post-load fail-closed verification (`review-rd274.md` Round-3 §1a + 1Password/sandbox gate): | | 699 | +/// reads back Chromium's persisted `extensions.settings.<loaded_id>` after `Extensions.loadUnpacked` | | 700 | +/// succeeds and requires ALL THREE: | 675 | 701 | /// 1. `creation_flags` is present AND bit `1 << 2` (`0x4`, `Extension::ALLOW_FILE_ACCESS`) is `0`, | 676 | | -/// 2. `newAllowFileAccess` is present AND `false`. | | 702 | +/// 2. `newAllowFileAccess` is present AND `false`, | | 703 | +/// 3. Neither `active_permissions.api` nor `granted_permissions.api` contains any entry in | | 704 | +/// [`crate::extensions::manifest::STRIPPED_NATIVE_PERMS`] (`nativeMessaging`, `downloads`, | | 705 | +/// `downloads.open`, `downloads.ui`, `management`). | 677 | 706 | /// | 678 | | -/// Catches any path-normalization drift on macOS/Linux or future Chromium versions immediately so | 679 | | -/// the caller uninstalls the extension instead of failing open with `ALLOW_FILE_ACCESS`. | | 707 | +/// Catches any path-normalization drift or manifest-stripping failure immediately so the caller | | 708 | +/// uninstalls the extension instead of failing open. | 680 | 709 | pub fn verify_extension_file_access_disabled(loaded_id: &str) -> bool { | 681 | 710 | const EXTENSION_ALLOW_FILE_ACCESS: i32 = 1 << 2; | 682 | 711 | let Some(ctx) = cef::request_context_get_global_context() else { | @@ -708,7 +737,25 @@ pub fn verify_extension_file_access_disabled(loaded_id: &str) -> bool { | 708 | 737 | { | 709 | 738 | return false; | 710 | 739 | } | 711 | | - ext_dict.bool(Some(&allow_key)) == 0 | | 740 | + if ext_dict.bool(Some(&allow_key)) != 0 { | | 741 | + return false; | | 742 | + } | | 743 | + // Fail closed if Chromium's own C++ ExtensionPrefs granted any stripped native API permission. | | 744 | + for perm_bucket in ["active_permissions", "granted_permissions"] { | | 745 | + let Some(bucket) = ext_dict.dictionary(Some(&CefString::from(perm_bucket))) else { | | 746 | + continue; | | 747 | + }; | | 748 | + let Some(api_list) = bucket.list(Some(&CefString::from("api"))) else { | | 749 | + continue; | | 750 | + }; | | 751 | + for i in 0..api_list.size() { | | 752 | + let api_name = CefString::from(&api_list.string(i)).to_string(); | | 753 | + if crate::extensions::manifest::STRIPPED_NATIVE_PERMS.contains(&api_name.as_str()) { | | 754 | + return false; | | 755 | + } | | 756 | + } | | 757 | + } | | 758 | + true | 712 | 759 | } | 713 | 760 |
| 714 | 761 | wrap_request_context_handler! { | |
Collapse file Copy file name to clipboardExpand all lines: apps/browser-engine/src/engine.rs +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -675,9 +675,12 @@ impl EngineManager { | 675 | 675 | } | 676 | 676 | HostMsg::ResetPermission { origin, kind } => { | 677 | 677 | self.permissions.reset_profile_permission(&origin, kind); | | 678 | + // No unused media-gate Allow outlives a change to the site's permissions. | | 679 | + self.tabs.values().for_each(|t| t.prompts.clear_media_gate_allows()); | 678 | 680 | } | 679 | 681 | HostMsg::SyncSitePermissions { entries } => { | 680 | 682 | self.permissions.sync_profile_permissions(&entries); | | 683 | + self.tabs.values().for_each(|t| t.prompts.clear_media_gate_allows()); | 681 | 684 | if entries.iter().any(|e| e.allow) { | 682 | 685 | self.flush_bfcache_for_default_tabs(); | 683 | 686 | } | @@ -1234,7 +1237,7 @@ impl EngineManager { | 1234 | 1237 | let permission = crate::prompts::TabPermissionHandler::new( | 1235 | 1238 | tab_id, | 1236 | 1239 | is_preview, | 1237 | | - context_ready, | | 1240 | + context_ready.clone(), | 1238 | 1241 | self.prompt_shared.clone(), | 1239 | 1242 | prompts.clone(), | 1240 | 1243 | self.out_tx.clone(), | @@ -1356,7 +1359,7 @@ impl EngineManager { | 1356 | 1359 | let mut observer = TabCdpObserver::new( | 1357 | 1360 | tab_id, is_popup, isolated, is_preview, snap.clone(), cdp_id_map.clone(), | 1358 | 1361 | internal_picked.clone(), pending_clears.clone(), cdp_ledger.clone(), passkeys.clone(), | 1359 | | - media_gate.clone(), self.prompt_shared.clone(), input_guard.clone(), emulation_scale.clone(), | | 1362 | + media_gate.clone(), context_ready, self.prompt_shared.clone(), input_guard.clone(), emulation_scale.clone(), | 1360 | 1363 | self.next_cdp_id.clone(), prompts.clone(), self.permissions.clone(), | 1361 | 1364 | self.extensions.is_some(), self.events.clone(), self.out_tx.clone(), | 1362 | 1365 | ); | |
Collapse file Copy file name to clipboardExpand all lines: apps/browser-engine/src/engine/extensions.rs +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -936,6 +936,8 @@ impl EngineManager { | 936 | 936 | t.snap.lock().unwrap().agent_driven = agent_driven; | 937 | 937 | sync_file_choosers(t); | 938 | 938 | if agent_driven { | | 939 | + // The person's unused media-gate Allow is theirs: the agent never inherits it. | | 940 | + t.prompts.clear_media_gate_allows(); | 939 | 941 | // Agent-driven tabs permanently refuse WebAuthn/passkeys (`chromium.ts:834-845`). | 940 | 942 | for raw in t.passkeys.enforce_messages() { | 941 | 943 | t.host.send_dev_tools_message(Some(raw.as_bytes())); | |
Collapse file Copy file name to clipboardExpand all lines: apps/browser-engine/src/extensions/cdp.rs +29-20Lines changed: 29 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -158,13 +158,15 @@ impl ExtensionHost { | 158 | 158 | json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Runtime.enable", "params": {} }), | 159 | 159 | json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Page.enable", "params": {} }), | 160 | 160 | auto_attach_cmd(self.alloc_id(), &sid), | 161 | | - fetch_enable_cmd(fetch_id, &sid), | 162 | 161 | ]; | 163 | 162 | if kind != SessionKind::SeedProbe { | 164 | | - let code = shim_source(kind == SessionKind::PopupPage); | | 163 | + let ext_id = self.sessions.get(&sid).map(|s| s.ext_id.clone()).unwrap_or_default(); | | 164 | + let perms = self.extensions.get(&ext_id).map(|e| e.manifest.permissions.as_slice()).unwrap_or(&[]); | | 165 | + let code = shim_source(kind == SessionKind::PopupPage, perms); | 165 | 166 | cmds.push(json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Runtime.addBinding", "params": { "name": "__ocExtCall" } })); | 166 | 167 | cmds.push(json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Page.addScriptToEvaluateOnNewDocument", "params": { "source": code } })); | 167 | 168 | } | | 169 | + cmds.push(fetch_enable_cmd(fetch_id, &sid)); | 168 | 170 | cmds | 169 | 171 | } | 170 | 172 | }; | @@ -175,9 +177,10 @@ impl ExtensionHost { | 175 | 177 | } | 176 | 178 | "Debugger.paused" => { | 177 | 179 | if let Some(sid) = session_id | 178 | | - && let Some(sess) = self.sessions.get(&sid) | | 180 | + && let Some((kind, ext_id)) = self.sessions.get(&sid).map(|s| (s.kind, s.ext_id.clone())) | 179 | 181 | { | 180 | | - let code = shim_source(sess.kind == SessionKind::PopupPage); | | 182 | + let perms = self.extensions.get(&ext_id).map(|e| e.manifest.permissions.as_slice()).unwrap_or(&[]); | | 183 | + let code = shim_source(kind == SessionKind::PopupPage, perms); | 181 | 184 | let pause_now = Instant::now(); | 182 | 185 | let eval_id = self.send_cdp( | 183 | 186 | "Runtime.evaluate", | @@ -616,22 +619,20 @@ impl ExtensionHost { | 616 | 619 | // Never attach a second concurrent CDP session to the same service-worker target | 617 | 620 | // (e.g. from a child page's `Target.setAutoAttach` when the browser target already | 618 | 621 | // attached it), which causes competing `Debugger`/`Runtime.evaluate` races. | | 622 | + // Detach ONLY (never send `Runtime.runIfWaitingForDebugger` on the duplicate session) | | 623 | + // so this session releases only its own auto-attach throttle without prematurely | | 624 | + // unpausing the worker before the primary session's `Fetch.enable` confirms. | 619 | 625 | if !target_id.is_empty() | 620 | 626 | && self.sessions.values().any(|s| s.kind == SessionKind::ServiceWorker && s.target_id == target_id) | 621 | 627 | { | 622 | | - let mut batch = Vec::new(); | 623 | | - if waiting { | 624 | | - batch.push(json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Runtime.runIfWaitingForDebugger", "params": {} })); | 625 | | - } | 626 | | - batch.push(json!({ "id": self.alloc_id(), "method": "Target.detachFromTarget", "params": { "sessionId": sid } })); | 627 | | - self.pipe.send_batch(&batch); | | 628 | + let _ = self.send_cdp("Target.detachFromTarget", json!({ "sessionId": sid }), None); | 628 | 629 | return effects; | 629 | 630 | } | 630 | 631 | let ext_id = ext_id.to_owned(); | 631 | 632 | self.sessions.insert( | 632 | 633 | sid.to_owned(), | 633 | 634 | AttachedSession { | 634 | | - ext_id, | | 635 | + ext_id: ext_id.clone(), | 635 | 636 | target_id, | 636 | 637 | kind: SessionKind::ServiceWorker, | 637 | 638 | url: url.to_owned(), | @@ -667,7 +668,8 @@ impl ExtensionHost { | 667 | 668 | s.pause_started = Some(Instant::now()); | 668 | 669 | s.pending_shim_eval_id = Some(eval_id); | 669 | 670 | } | 670 | | - let code = shim_source(false); | | 671 | + let perms = self.extensions.get(&ext_id).map(|e| e.manifest.permissions.as_slice()).unwrap_or(&[]); | | 672 | + let code = shim_source(false, perms); | 671 | 673 | let batch = vec![ | 672 | 674 | json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Runtime.enable", "params": {} }), | 673 | 675 | auto_attach_cmd(self.alloc_id(), sid), | @@ -710,10 +712,7 @@ impl ExtensionHost { | 710 | 712 | if waiting { | 711 | 713 | self.pending_fetch_resume.insert(fetch_id, sid.to_owned()); | 712 | 714 | } | 713 | | - let mut batch = vec![ | 714 | | - auto_attach_cmd(self.alloc_id(), sid), | 715 | | - fetch_enable_cmd(fetch_id, sid), | 716 | | - ]; | | 715 | + let mut batch = vec![auto_attach_cmd(self.alloc_id(), sid)]; | 717 | 716 | if ttype == "iframe" { | 718 | 717 | // Neutralize native `chrome.tabs`/`windows`/etc. inside extension iframes while | 719 | 718 | // keeping `chrome.runtime` native (never installs `__ocExtCall`, READER-12 C2). | @@ -725,6 +724,7 @@ impl ExtensionHost { | 725 | 724 | "params": { "source": IFRAME_LOCKDOWN_JS } | 726 | 725 | })); | 727 | 726 | } | | 727 | + batch.push(fetch_enable_cmd(fetch_id, sid)); | 728 | 728 | self.pipe.send_batch(&batch); | 729 | 729 | return effects; | 730 | 730 | } | @@ -766,7 +766,7 @@ impl ExtensionHost { | 766 | 766 | self.sessions.insert( | 767 | 767 | sid.to_owned(), | 768 | 768 | AttachedSession { | 769 | | - ext_id, | | 769 | + ext_id: ext_id.clone(), | 770 | 770 | target_id, | 771 | 771 | kind, | 772 | 772 | url: url.to_owned(), | @@ -788,10 +788,10 @@ impl ExtensionHost { | 788 | 788 | json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Runtime.enable", "params": {} }), | 789 | 789 | json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Page.enable", "params": {} }), | 790 | 790 | auto_attach_cmd(self.alloc_id(), sid), | 791 | | - fetch_enable_cmd(fetch_id, sid), | 792 | 791 | ]; | 793 | 792 | if kind != SessionKind::SeedProbe { | 794 | | - let code = shim_source(kind == SessionKind::PopupPage); | | 793 | + let perms = self.extensions.get(&ext_id).map(|e| e.manifest.permissions.as_slice()).unwrap_or(&[]); | | 794 | + let code = shim_source(kind == SessionKind::PopupPage, perms); | 795 | 795 | batch.push(json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Runtime.addBinding", "params": { "name": "__ocExtCall" } })); | 796 | 796 | batch.push(json!({ "id": self.alloc_id(), "sessionId": sid, "method": "Page.addScriptToEvaluateOnNewDocument", "params": { "source": code } })); | 797 | 797 | if let Some(s) = self.sessions.get_mut(sid) { | @@ -802,6 +802,7 @@ impl ExtensionHost { | 802 | 802 | ); | 803 | 803 | } | 804 | 804 | } | | 805 | + batch.push(fetch_enable_cmd(fetch_id, sid)); | 805 | 806 | // Resume happens strictly in `handle_cdp_reply` after `fetch_id` confirms. | 806 | 807 | self.pipe.send_batch(&batch); | 807 | 808 | return effects; | @@ -1144,9 +1145,17 @@ const IFRAME_LOCKDOWN_JS: &str = r#"(() => { | 1144 | 1145 | let root; | 1145 | 1146 | try { root = globalThis[rootName]; } catch { continue; } | 1146 | 1147 | if (!root) continue; | 1147 | | - for (const api of ["tabs", "windows", "action", "browserAction", "pageAction", "contextMenus", "webNavigation"]) { | | 1148 | + for (const api of ["tabs", "windows", "action", "browserAction", "pageAction", "contextMenus", "webNavigation", "downloads", "management"]) { | 1148 | 1149 | try { Object.defineProperty(root, api, { value: undefined, configurable: false, enumerable: false, writable: false }); } catch {} | 1149 | 1150 | } | | 1151 | + try { | | 1152 | + const rt = root.runtime; | | 1153 | + if (rt && typeof rt === "object") { | | 1154 | + for (const m of ["connectNative", "sendNativeMessage"]) { | | 1155 | + try { Object.defineProperty(rt, m, { value: undefined, configurable: false, enumerable: false, writable: false }); } catch {} | | 1156 | + } | | 1157 | + } | | 1158 | + } catch {} | 1150 | 1159 | } | 1151 | 1160 | })();"#; | 1152 | 1161 |
| |
|