Fix draggable region validation bypass in GuestViewBase [chromium/src : main]

0 views
Skip to first unread message

Zoraiz Naeem (Gerrit)

unread,
May 28, 2026, 9:29:10 PM (4 days ago) May 28
to James Cook, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
Attention needed from James Cook

Zoraiz Naeem added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Zoraiz Naeem . resolved

jamescook@ PTAL at guest_view_base.cc and app_window.cc

Open in Gerrit

Related details

Attention is currently required from:
  • James Cook
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
Gerrit-Change-Number: 7884657
Gerrit-PatchSet: 4
Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
Gerrit-Reviewer: James Cook <jame...@chromium.org>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Kevin McNee <mc...@chromium.org>
Gerrit-Attention: James Cook <jame...@chromium.org>
Gerrit-Comment-Date: Fri, 29 May 2026 01:28:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

James Cook (Gerrit)

unread,
May 28, 2026, 10:02:37 PM (4 days ago) May 28
to Zoraiz Naeem, Achuith Bhandarkar, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
Attention needed from Zoraiz Naeem

James Cook added 2 comments

Patchset-level comments
James Cook . resolved

One question. Also, your trybots are red. :-)

File chrome/browser/ui/webui_browser/webui_browser_web_contents_delegate.cc
Line 40, Patchset 4 (Latest): if (contents != web_contents()) {
James Cook . unresolved

Can you explain in more detail, either here in a comment or in the CL description, why this mismatch is allowed? Or rather, why it has to be logged as an error rather than CHECKed? It not being a CHECK makes it seem like it's expected, but LOG(ERROR) implies that it's not.

Open in Gerrit

Related details

Attention is currently required from:
  • Zoraiz Naeem
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
    Gerrit-Change-Number: 7884657
    Gerrit-PatchSet: 4
    Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
    Gerrit-Reviewer: James Cook <jame...@chromium.org>
    Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
    Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
    Gerrit-Attention: Zoraiz Naeem <zorai...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 02:02:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Zoraiz Naeem (Gerrit)

    unread,
    May 29, 2026, 8:58:25 PM (3 days ago) May 29
    to Achuith Bhandarkar, Chromium LUCI CQ, James Cook, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
    Attention needed from James Cook

    Zoraiz Naeem voted and added 2 comments

    Votes added by Zoraiz Naeem

    Commit-Queue+1

    2 comments

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Zoraiz Naeem . resolved

    PTAL again.

    File chrome/browser/ui/webui_browser/webui_browser_web_contents_delegate.cc
    Line 40, Patchset 4: if (contents != web_contents()) {
    James Cook . unresolved

    Can you explain in more detail, either here in a comment or in the CL description, why this mismatch is allowed? Or rather, why it has to be logged as an error rather than CHECKed? It not being a CHECK makes it seem like it's expected, but LOG(ERROR) implies that it's not.

    Zoraiz Naeem

    Thanks for pointing it out. I just released that by default, we do not collect draggable regions. Chrome only enables collecting draggable regions for certain cases and even in those cases, it only does for the main web-contents. [1]

    For other cases like Chrome Apps, we explicitly enable draggable regions via `contents::WebContents::SetSupportsDraggableRegions)`. So in cases of chrome apps etc, we can keep the check.

    It only for GLiC that we explicitly enable draggable regions for its `webview`.

    [1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/web_applications/app_browser_controller.cc;l=902-904;drc=3bd91234050186906aac8fbfc086dc17e4050546

    Open in Gerrit

    Related details

    Attention is currently required from:
    • James Cook
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
    Gerrit-Change-Number: 7884657
    Gerrit-PatchSet: 7
    Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
    Gerrit-Reviewer: James Cook <jame...@chromium.org>
    Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
    Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Kevin McNee <mc...@chromium.org>
    Gerrit-Attention: James Cook <jame...@chromium.org>
    Gerrit-Comment-Date: Sat, 30 May 2026 00:58:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: James Cook <jame...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Zoraiz Naeem (Gerrit)

    unread,
    May 29, 2026, 8:59:51 PM (3 days ago) May 29
    to Achuith Bhandarkar, Chromium LUCI CQ, James Cook, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
    Attention needed from James Cook

    Zoraiz Naeem added 1 comment

    File chrome/browser/ui/webui_browser/webui_browser_web_contents_delegate.cc
    Line 40, Patchset 4: if (contents != web_contents()) {
    James Cook . unresolved

    Can you explain in more detail, either here in a comment or in the CL description, why this mismatch is allowed? Or rather, why it has to be logged as an error rather than CHECKed? It not being a CHECK makes it seem like it's expected, but LOG(ERROR) implies that it's not.

    Zoraiz Naeem

    Thanks for pointing it out. I just released that by default, we do not collect draggable regions. Chrome only enables collecting draggable regions for certain cases and even in those cases, it only does for the main web-contents. [1]

    For other cases like Chrome Apps, we explicitly enable draggable regions via `contents::WebContents::SetSupportsDraggableRegions)`. So in cases of chrome apps etc, we can keep the check.

    It only for GLiC that we explicitly enable draggable regions for its `webview`.

    [1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/web_applications/app_browser_controller.cc;l=902-904;drc=3bd91234050186906aac8fbfc086dc17e4050546

    Zoraiz Naeem

    Anyways, the crux of the fix, passing the correct draggable region in GuestViewBase.

    Gerrit-Comment-Date: Sat, 30 May 2026 00:59:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: James Cook <jame...@chromium.org>
    Comment-In-Reply-To: Zoraiz Naeem <zorai...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    James Cook (Gerrit)

    unread,
    12:18 PM (5 hours ago) 12:18 PM
    to Zoraiz Naeem, Achuith Bhandarkar, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
    Attention needed from Zoraiz Naeem

    James Cook voted and added 1 comment

    Votes added by James Cook

    Code-Review+1

    1 comment

    Patchset-level comments
    James Cook . resolved

    LGTM, thanks.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Zoraiz Naeem
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
      Gerrit-Change-Number: 7884657
      Gerrit-PatchSet: 7
      Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-Reviewer: James Cook <jame...@chromium.org>
      Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Kevin McNee <mc...@chromium.org>
      Gerrit-Attention: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-Comment-Date: Mon, 01 Jun 2026 16:18:11 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Zoraiz Naeem (Gerrit)

      unread,
      1:51 PM (3 hours ago) 1:51 PM
      to Ian Wells, James Cook, Achuith Bhandarkar, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
      Attention needed from Ian Wells

      Zoraiz Naeem added 1 comment

      Patchset-level comments
      Zoraiz Naeem . resolved

      PTAL.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Wells
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
      Gerrit-Change-Number: 7884657
      Gerrit-PatchSet: 7
      Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-Reviewer: Ian Wells <iwe...@chromium.org>
      Gerrit-Reviewer: James Cook <jame...@chromium.org>
      Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Kevin McNee <mc...@chromium.org>
      Gerrit-Attention: Ian Wells <iwe...@chromium.org>
      Gerrit-Comment-Date: Mon, 01 Jun 2026 17:50:55 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ian Wells (Gerrit)

      unread,
      2:10 PM (3 hours ago) 2:10 PM
      to Zoraiz Naeem, James Cook, Achuith Bhandarkar, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org
      Attention needed from Zoraiz Naeem

      Ian Wells voted and added 1 comment

      Votes added by Ian Wells

      Code-Review+1

      1 comment

      File chrome/browser/glic/widget/glic_view.cc
      Line 108, Patchset 7 (Latest): const bool is_webview_contents = web_contents() != contents;
      Ian Wells . unresolved

      Nit, please put this definition closer to the SetDraggableRegion call where it is used

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Zoraiz Naeem
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
      Gerrit-Change-Number: 7884657
      Gerrit-PatchSet: 7
      Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-Reviewer: Ian Wells <iwe...@chromium.org>
      Gerrit-Reviewer: James Cook <jame...@chromium.org>
      Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Kevin McNee <mc...@chromium.org>
      Gerrit-Attention: Zoraiz Naeem <zorai...@chromium.org>
      Gerrit-Comment-Date: Mon, 01 Jun 2026 18:09:48 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Zoraiz Naeem (Gerrit)

      unread,
      2:19 PM (3 hours ago) 2:19 PM
      to Ian Wells, James Cook, Achuith Bhandarkar, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org

      Zoraiz Naeem voted and added 2 comments

      Votes added by Zoraiz Naeem

      Commit-Queue+2

      2 comments

      File chrome/browser/glic/widget/glic_view.cc
      Line 108, Patchset 7: const bool is_webview_contents = web_contents() != contents;
      Ian Wells . resolved

      Nit, please put this definition closer to the SetDraggableRegion call where it is used

      Zoraiz Naeem

      Done

      File chrome/browser/ui/webui_browser/webui_browser_web_contents_delegate.cc
      Line 40, Patchset 4: if (contents != web_contents()) {
      James Cook . resolved

      Can you explain in more detail, either here in a comment or in the CL description, why this mismatch is allowed? Or rather, why it has to be logged as an error rather than CHECKed? It not being a CHECK makes it seem like it's expected, but LOG(ERROR) implies that it's not.

      Zoraiz Naeem

      Thanks for pointing it out. I just released that by default, we do not collect draggable regions. Chrome only enables collecting draggable regions for certain cases and even in those cases, it only does for the main web-contents. [1]

      For other cases like Chrome Apps, we explicitly enable draggable regions via `contents::WebContents::SetSupportsDraggableRegions)`. So in cases of chrome apps etc, we can keep the check.

      It only for GLiC that we explicitly enable draggable regions for its `webview`.

      [1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/web_applications/app_browser_controller.cc;l=902-904;drc=3bd91234050186906aac8fbfc086dc17e4050546

      Zoraiz Naeem

      Anyways, the crux of the fix, passing the correct draggable region in GuestViewBase.

      Zoraiz Naeem

      Done

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
        Gerrit-Change-Number: 7884657
        Gerrit-PatchSet: 8
        Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
        Gerrit-Reviewer: Ian Wells <iwe...@chromium.org>
        Gerrit-Reviewer: James Cook <jame...@chromium.org>
        Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
        Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: Kevin McNee <mc...@chromium.org>
        Gerrit-Comment-Date: Mon, 01 Jun 2026 18:19:10 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: James Cook <jame...@chromium.org>
        Comment-In-Reply-To: Zoraiz Naeem <zorai...@chromium.org>
        Comment-In-Reply-To: Ian Wells <iwe...@chromium.org>
        satisfied_requirement
        open
        diffy

        Zoraiz Naeem (Gerrit)

        unread,
        2:19 PM (3 hours ago) 2:19 PM
        to Ian Wells, James Cook, Achuith Bhandarkar, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org

        Zoraiz Naeem added 1 comment

        Patchset-level comments
        File-level comment, Patchset 8 (Latest):
        Zoraiz Naeem . resolved

        Thanks for the review :)

        Gerrit-Comment-Date: Mon, 01 Jun 2026 18:19:24 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        open
        diffy

        Chromium LUCI CQ (Gerrit)

        unread,
        4:08 PM (1 hour ago) 4:08 PM
        to Zoraiz Naeem, Ian Wells, James Cook, Achuith Bhandarkar, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, dewitt...@chromium.org, extension...@chromium.org

        Chromium LUCI CQ submitted the change with unreviewed changes

        Unreviewed changes

        7 is the latest approved patch-set.
        The change was submitted with unreviewed changes in the following files:

        ```
        The name of the file: chrome/browser/glic/widget/glic_view.cc
        Insertions: 5, Deletions: 5.

        @@ -101,11 +101,6 @@
        void GlicView::DraggableRegionsChanged(
        const std::vector<blink::mojom::DraggableRegionPtr>& regions,
        content::WebContents* contents) {
        - // `GlicView::DraggableRegionsChanged()` is called when draggable regions for
        - // either the main-webcontents or guest-webcontents are changed.
        - // guest-webcontents are the webcontents associated to `<webview>` hosting the
        - // glic web app,
        - const bool is_webview_contents = web_contents() != contents;
        SkRegion sk_region;
        for (const auto& region : regions) {
        sk_region.op(
        @@ -114,6 +109,11 @@
        region->draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
        }

        + // `GlicView::DraggableRegionsChanged()` is called when draggable regions for
        + // either the main-webcontents or guest-webcontents are changed.
        + // guest-webcontents are the webcontents associated to `<webview>` hosting the
        + // glic web app,
        + const bool is_webview_contents = web_contents() != contents;
        SetDraggableRegion(sk_region, /*for_webview=*/is_webview_contents);
        }

        ```

        Change information

        Commit message:
        Fix draggable region validation bypass in GuestViewBase

        GuestViewBase::DraggableRegionsChanged was incorrectly substituting the
        embedder's WebContents for the source WebContents when forwarding the
        event to the embedder delegate. This laundering bypassed source
        validation checks in downstream delegates like AppWindow.

        This CL fixes the vulnerability by passing the original guest
        WebContents to the embedder delegate.
        Bug: b:516413817
        Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
        Commit-Queue: Zoraiz Naeem <zorai...@chromium.org>
        Reviewed-by: James Cook <jame...@chromium.org>
        Reviewed-by: Ian Wells <iwe...@chromium.org>
        Cr-Commit-Position: refs/heads/main@{#1639613}
        Files:
        • M chrome/browser/glic/widget/glic_view.cc
        • M chrome/browser/glic/widget/glic_view.h
        • M components/guest_view/browser/guest_view_base.cc
        Change size: S
        Delta: 3 files changed, 15 insertions(+), 13 deletions(-)
        Branch: refs/heads/main
        Submit Requirements:
        • requirement satisfiedCode-Review: +1 by Ian Wells, +1 by James Cook
        Open in Gerrit
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: merged
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I71d1c2bf75db0f7561df5214d9d97cf1d56610f2
        Gerrit-Change-Number: 7884657
        Gerrit-PatchSet: 9
        Gerrit-Owner: Zoraiz Naeem <zorai...@chromium.org>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Gerrit-Reviewer: Ian Wells <iwe...@chromium.org>
        Gerrit-Reviewer: James Cook <jame...@chromium.org>
        Gerrit-Reviewer: Zoraiz Naeem <zorai...@chromium.org>
        Gerrit-CC: Achuith Bhandarkar <ach...@chromium.org>
        open
        diffy
        satisfied_requirement
        Reply all
        Reply to author
        Forward
        0 new messages