Commit f135b809 authored by Darwin Huang's avatar Darwin Huang Committed by Commit Bot

Raw Clipboard: Check that feature enabled in browser process.

Previously, this check was only made in the renderer process, which
isn't quite as trusted. Checks like this should all be done in the
browser process.

Bug: 1034023
Change-Id: I5c9303f0f2947f65467780550da797b0cef8a568
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2064828
Commit-Queue: Darwin Huang <huangdarwin@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742884}
parent a95e4be5
......@@ -11,6 +11,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/common/child_process_host.h"
#include "ipc/ipc_message.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/clipboard/raw_clipboard.mojom.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom-shared.h"
#include "ui/base/clipboard/clipboard.h"
......@@ -27,8 +28,13 @@ void RawClipboardHostImpl::Create(
PermissionControllerImpl::FromBrowserContext(
render_frame_host->GetProcess()->GetBrowserContext());
// Permission should already be checked in the renderer process, but recheck
// in the browser process in case of a hijacked renderer.
// Feature flags and permission should already be checked in the renderer
// process, but recheck in the browser process in case of a hijacked renderer.
if (!base::FeatureList::IsEnabled(blink::features::kRawClipboard)) {
mojo::ReportBadMessage("Raw Clipboard is not enabled");
return;
}
blink::mojom::PermissionStatus status =
permission_controller->GetPermissionStatusForFrame(
PermissionType::CLIPBOARD_READ_WRITE, render_frame_host,
......@@ -103,4 +109,4 @@ void RawClipboardHostImpl::CommitWrite() {
new ui::ScopedClipboardWriter(ui::ClipboardBuffer::kCopyPaste));
}
} // namespace content
\ No newline at end of file
} // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment