Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1862953002: Disallow use of Web Bluetooth from cross-origin iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
index c7a2dd3c5d1d75e97a7c619156e51d6fee24e341..345e1029d6a6fd8ec331f77e1c226ad32f32d086 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -1137,13 +1137,18 @@ void BluetoothDispatcherHost::OnRequestDeviceImpl(
const url::Origin embedding_origin =
web_contents->GetMainFrame()->GetLastCommittedOrigin();
- if (requesting_origin.unique()) {
- VLOG(1) << "Request device with unique origin.";
Jeffrey Yasskin 2016/04/06 05:38:31 I'm dropping the VLOG because we send the same inf
+ // TODO(crbug.com/518042): Enforce correctly-delegated permissions instead of
+ // matching origins. When relaxing this, take care to handle non-sandboxed
+ // unique origins.
+ if (embedding_origin != requesting_origin) {
Mike West 2016/04/06 06:06:59 I'd prefer `!embedding_origin.IsSameOriginWith(req
Jeffrey Yasskin 2016/04/06 06:17:15 Done, thanks for the clear opinion and rationale.
Send(new BluetoothMsg_RequestDeviceError(
thread_id, request_id,
- WebBluetoothError::REQUEST_DEVICE_WITH_UNIQUE_ORIGIN));
+ WebBluetoothError::REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME));
return;
}
+ // The above also excludes unique origins, which are not even same-origin with
+ // themselves.
+ DCHECK(!requesting_origin.unique());
DCHECK(adapter_.get());

Powered by Google App Engine
This is Rietveld 408576698