Add request_url to TrustedHeaderClient::OnBeforeSendHeaders [chromium/src : main]

1 view
Skip to first unread message

Anatoli Hancharou (Gerrit)

unread,
Jun 1, 2026, 2:20:47 PM (13 days ago) Jun 1
to Colin Blundell, Chromium IPC Reviews, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Chromium IPC Reviews

Anatoli Hancharou added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Anatoli Hancharou . resolved

blundell@ for:

  • service/network/*
  • chrome/browser/net/ websocket_browsertest.cc

andreaorru@ for:

  • extensions/browser/api/web_request/*
  • components/guest_view/browser/slim_web_view/slim_web_view_url_loader_factory_interceptor.cc

nasko@ for:

  • content/browser/devtools/ devtools_url_loader_interceptor.cc
Open in Gerrit

Related details

Attention is currently required from:
  • Chromium IPC Reviews
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: I0f680a5876718d160d79cda04a528d45ed61f151
Gerrit-Change-Number: 7885325
Gerrit-PatchSet: 1
Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Kevin McNee <mc...@chromium.org>
Gerrit-Attention: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-Comment-Date: Mon, 01 Jun 2026 18:20:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

gwsq (Gerrit)

unread,
Jun 1, 2026, 2:30:25 PM (13 days ago) Jun 1
to Anatoli Hancharou, Chromium IPC Reviews, Mike West, Colin Blundell, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Mike West

Message from gwsq

From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
IPC: mk...@chromium.org, na...@chromium.org

📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).

IPC reviewer(s): mk...@chromium.org, na...@chromium.org


Reviewer source(s):
mk...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)

Open in Gerrit

Related details

Attention is currently required from:
  • Mike West
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: I0f680a5876718d160d79cda04a528d45ed61f151
Gerrit-Change-Number: 7885325
Gerrit-PatchSet: 1
Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
Gerrit-Reviewer: Mike West <mk...@chromium.org>
Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Kevin McNee <mc...@chromium.org>
Gerrit-CC: gwsq
Gerrit-Attention: Mike West <mk...@chromium.org>
Gerrit-Comment-Date: Mon, 01 Jun 2026 18:29:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Nasko Oskov (Gerrit)

unread,
Jun 2, 2026, 5:29:12 PM (12 days ago) Jun 2
to Anatoli Hancharou, Chromium IPC Reviews, Mike West, Colin Blundell, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Anatoli Hancharou and Mike West

Nasko Oskov added 2 comments

File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
Line 625, Patchset 1 (Latest):
Nasko Oskov . unresolved

Should we check here that the `request_.url` is the same as the incoming `request_url` parameter, similarly to the check in the web sockets case?

What happens if the URLs mismatch?

File extensions/browser/api/web_request/web_request_proxying_websocket.cc
Line 293, Patchset 1 (Latest): DCHECK_EQ(request_url, info_.url);
Nasko Oskov . unresolved

What happens if these two disagree? Would the code behave as expected?

Open in Gerrit

Related details

Attention is currently required from:
  • Anatoli Hancharou
  • Mike West
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: I0f680a5876718d160d79cda04a528d45ed61f151
    Gerrit-Change-Number: 7885325
    Gerrit-PatchSet: 1
    Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
    Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
    Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-Reviewer: Mike West <mk...@chromium.org>
    Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
    Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Kevin McNee <mc...@chromium.org>
    Gerrit-CC: gwsq
    Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
    Gerrit-Attention: Mike West <mk...@chromium.org>
    Gerrit-Comment-Date: Tue, 02 Jun 2026 21:29:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mike West (Gerrit)

    unread,
    Jun 3, 2026, 10:15:30 AM (11 days ago) Jun 3
    to Anatoli Hancharou, Chromium IPC Reviews, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
    Attention needed from Anatoli Hancharou, Andrea Orru and Colin Blundell

    Mike West added 1 comment

    Patchset-level comments
    Mike West . resolved

    Given my understanding of how this URL will be used (matching against a policy as described in the DD), there's not much additional checking I'd ask for beyond the type itself.

    Assuming the relevant owners are happy with the approach generally, the mojo interface changes seem reasonable. Happy to stamp them once owners weigh in.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anatoli Hancharou
    • Andrea Orru
    • Colin Blundell
    Gerrit-Attention: Colin Blundell <blun...@chromium.org>
    Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
    Gerrit-Attention: Andrea Orru <andre...@chromium.org>
    Gerrit-Comment-Date: Wed, 03 Jun 2026 14:15:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Anatoli Hancharou (Gerrit)

    unread,
    Jun 3, 2026, 10:51:19 AM (11 days ago) Jun 3
    to Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
    Attention needed from Andrea Orru, Colin Blundell and Nasko Oskov

    Anatoli Hancharou added 2 comments

    File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
    Line 625, Patchset 1:
    Nasko Oskov . resolved

    Should we check here that the `request_.url` is the same as the incoming `request_url` parameter, similarly to the check in the web sockets case?

    What happens if the URLs mismatch?

    Anatoli Hancharou

    Done.

    "What happens if the URLs mismatch?" - replied in the second comment's thread

    File extensions/browser/api/web_request/web_request_proxying_websocket.cc
    Line 293, Patchset 1: DCHECK_EQ(request_url, info_.url);
    Nasko Oskov . unresolved

    What happens if these two disagree? Would the code behave as expected?

    Anatoli Hancharou

    My understanding: if the Network Service's actual URL (`request_url`) and the Browser's expected URL (`request_.url` / `info_.url`) disagree, it creates a silent security issue:
    1. **Incorrect rules applied:** The browser tells extensions we are loading URL A, so extensions inspect/modify headers thinking the request is going to URL A.
    2. **Data leak:** The Network Service actually requests URL B, meaning sensitive headers could be sent to URL B.
    3. **Blocking bypass:** A blocked URL B might load because the browser thinks it is the allowed URL A.

    This problem exists regardless of this CL I guess. By passing the actual URL over Mojo here, we can now add `DCHECK_EQ(request_url, request_.url);` to at least not letting it go silently.

    Potential problem related to my feature would be that headers that were supposed to be obtained for URL A, might be provided to URL B

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andrea Orru
    • Colin Blundell
    • Nasko Oskov
    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: I0f680a5876718d160d79cda04a528d45ed61f151
    Gerrit-Change-Number: 7885325
    Gerrit-PatchSet: 2
    Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
    Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
    Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
    Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
    Gerrit-Reviewer: Mike West <mk...@chromium.org>
    Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
    Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Kevin McNee <mc...@chromium.org>
    Gerrit-CC: gwsq
    Gerrit-Attention: Nasko Oskov <na...@chromium.org>
    Gerrit-Attention: Colin Blundell <blun...@chromium.org>
    Gerrit-Attention: Andrea Orru <andre...@chromium.org>
    Gerrit-Comment-Date: Wed, 03 Jun 2026 14:51:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nasko Oskov (Gerrit)

    unread,
    Jun 9, 2026, 3:33:42 PM (5 days ago) Jun 9
    to Anatoli Hancharou, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
    Attention needed from Anatoli Hancharou, Andrea Orru and Colin Blundell

    Nasko Oskov voted and added 2 comments

    Votes added by Nasko Oskov

    Code-Review+1

    2 comments

    Patchset-level comments
    File extensions/browser/api/web_request/web_request_proxying_websocket.cc
    Line 293, Patchset 1: DCHECK_EQ(request_url, info_.url);
    Nasko Oskov . unresolved

    What happens if these two disagree? Would the code behave as expected?

    Anatoli Hancharou

    My understanding: if the Network Service's actual URL (`request_url`) and the Browser's expected URL (`request_.url` / `info_.url`) disagree, it creates a silent security issue:
    1. **Incorrect rules applied:** The browser tells extensions we are loading URL A, so extensions inspect/modify headers thinking the request is going to URL A.
    2. **Data leak:** The Network Service actually requests URL B, meaning sensitive headers could be sent to URL B.
    3. **Blocking bypass:** A blocked URL B might load because the browser thinks it is the allowed URL A.

    This problem exists regardless of this CL I guess. By passing the actual URL over Mojo here, we can now add `DCHECK_EQ(request_url, request_.url);` to at least not letting it go silently.

    Potential problem related to my feature would be that headers that were supposed to be obtained for URL A, might be provided to URL B

    Nasko Oskov

    As per offline chat, let's proceed.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anatoli Hancharou
    • Andrea Orru
    • Colin Blundell
    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: I0f680a5876718d160d79cda04a528d45ed61f151
      Gerrit-Change-Number: 7885325
      Gerrit-PatchSet: 2
      Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
      Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
      Gerrit-Reviewer: Mike West <mk...@chromium.org>
      Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Kevin McNee <mc...@chromium.org>
      Gerrit-CC: gwsq
      Gerrit-Attention: Colin Blundell <blun...@chromium.org>
      Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
      Gerrit-Attention: Andrea Orru <andre...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Jun 2026 19:33:26 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
      Comment-In-Reply-To: Anatoli Hancharou <ant...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Colin Blundell (Gerrit)

      unread,
      Jun 10, 2026, 5:05:41 AM (4 days ago) Jun 10
      to Anatoli Hancharou, Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Anatoli Hancharou and Andrea Orru

      Colin Blundell added 1 comment

      Patchset-level comments
      Colin Blundell . resolved

      Thanks! //chrome and //components LGTM. +ricea@ for //services/network as closer OWNER

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Anatoli Hancharou
      • Andrea Orru
      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: I0f680a5876718d160d79cda04a528d45ed61f151
      Gerrit-Change-Number: 7885325
      Gerrit-PatchSet: 2
      Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
      Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
      Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
      Gerrit-Reviewer: Mike West <mk...@chromium.org>
      Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Kevin McNee <mc...@chromium.org>
      Gerrit-CC: gwsq
      Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrea Orru <andre...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 09:05:31 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Jun 10, 2026, 10:34:04 AM (4 days ago) Jun 10
      to Anatoli Hancharou, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Anatoli Hancharou and Andrea Orru

      Adam Rice added 1 comment

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 620, Patchset 2 (Latest): DCHECK_EQ(request_url, request_.url);
      Adam Rice . unresolved

      The browser process shouldn't DCHECK on data from a lower-privileged process. See https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md#failures-beyond-chromium_s-control

      Also, I don't understand why we are plumbing the URL back from the network service through mojo when we already have it in the browser process. I read the design doc but it didn't explain the reason for doing it.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anatoli Hancharou
      • Andrea Orru
      Gerrit-Attention: Andrea Orru <andre...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 14:33:25 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anatoli Hancharou (Gerrit)

      unread,
      Jun 10, 2026, 11:17:12 AM (4 days ago) Jun 10
      to Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrea Orru

      Anatoli Hancharou added 1 comment

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 620, Patchset 2 (Latest): DCHECK_EQ(request_url, request_.url);
      Adam Rice . unresolved

      The browser process shouldn't DCHECK on data from a lower-privileged process. See https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md#failures-beyond-chromium_s-control

      Also, I don't understand why we are plumbing the URL back from the network service through mojo when we already have it in the browser process. I read the design doc but it didn't explain the reason for doing it.

      Anatoli Hancharou

      This plumbing is actually being added to support a new feature that will be landing in a follow-up CL.

      You are completely right that the existing consumer of `TrustedHeaderClient` (the WebRequest API) already knows the URL because it proxies the entire `URLLoader` and tracks the URL through `CreateLoaderAndStart` and `FollowRedirect`.

      However, to minimize performance overhead, the upcoming Enterprise Header Injection feature is designed to be much more lightweight. It avoids proxying the `URLLoader` pipe entirely, and instead only proxies the `URLLoaderFactory` to attach the `TrustedHeaderClient`.

      Because the `URLLoader` remains unproxied, the browser process does not intercept `OnReceiveRedirect` or `FollowRedirect` for those requests. When a redirect occurs, the Network Service handles it internally and fires another `OnBeforeSendHeaders` to our `TrustedHeaderClient`. Without plumbing `request_url` through this mojo call, our client would have no idea that the URL has changed, and we would end up evaluating enterprise policies against the old pre-redirect URL

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrea Orru
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrea Orru <andre...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 15:16:47 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anatoli Hancharou (Gerrit)

      unread,
      Jun 10, 2026, 11:36:23 AM (4 days ago) Jun 10
      to Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrea Orru

      Anatoli Hancharou added 1 comment

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 620, Patchset 2 (Latest): DCHECK_EQ(request_url, request_.url);
      Adam Rice . unresolved

      The browser process shouldn't DCHECK on data from a lower-privileged process. See https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md#failures-beyond-chromium_s-control

      Also, I don't understand why we are plumbing the URL back from the network service through mojo when we already have it in the browser process. I read the design doc but it didn't explain the reason for doing it.

      Anatoli Hancharou

      This plumbing is actually being added to support a new feature that will be landing in a follow-up CL.

      You are completely right that the existing consumer of `TrustedHeaderClient` (the WebRequest API) already knows the URL because it proxies the entire `URLLoader` and tracks the URL through `CreateLoaderAndStart` and `FollowRedirect`.

      However, to minimize performance overhead, the upcoming Enterprise Header Injection feature is designed to be much more lightweight. It avoids proxying the `URLLoader` pipe entirely, and instead only proxies the `URLLoaderFactory` to attach the `TrustedHeaderClient`.

      Because the `URLLoader` remains unproxied, the browser process does not intercept `OnReceiveRedirect` or `FollowRedirect` for those requests. When a redirect occurs, the Network Service handles it internally and fires another `OnBeforeSendHeaders` to our `TrustedHeaderClient`. Without plumbing `request_url` through this mojo call, our client would have no idea that the URL has changed, and we would end up evaluating enterprise policies against the old pre-redirect URL

      Gerrit-Comment-Date: Wed, 10 Jun 2026 15:35:58 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Anatoli Hancharou <ant...@google.com>
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anatoli Hancharou (Gerrit)

      unread,
      Jun 10, 2026, 11:37:43 AM (4 days ago) Jun 10
      to Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrea Orru

      Anatoli Hancharou added 1 comment

      File extensions/browser/api/web_request/web_request_proxying_websocket.cc
      Line 293, Patchset 1: DCHECK_EQ(request_url, info_.url);
      Nasko Oskov . resolved

      What happens if these two disagree? Would the code behave as expected?

      Anatoli Hancharou

      My understanding: if the Network Service's actual URL (`request_url`) and the Browser's expected URL (`request_.url` / `info_.url`) disagree, it creates a silent security issue:
      1. **Incorrect rules applied:** The browser tells extensions we are loading URL A, so extensions inspect/modify headers thinking the request is going to URL A.
      2. **Data leak:** The Network Service actually requests URL B, meaning sensitive headers could be sent to URL B.
      3. **Blocking bypass:** A blocked URL B might load because the browser thinks it is the allowed URL A.

      This problem exists regardless of this CL I guess. By passing the actual URL over Mojo here, we can now add `DCHECK_EQ(request_url, request_.url);` to at least not letting it go silently.

      Potential problem related to my feature would be that headers that were supposed to be obtained for URL A, might be provided to URL B

      Nasko Oskov

      As per offline chat, let's proceed.

      Anatoli Hancharou

      Done

      Gerrit-Comment-Date: Wed, 10 Jun 2026 15:37:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrea Orru (Gerrit)

      unread,
      Jun 10, 2026, 1:24:50 PM (4 days ago) Jun 10
      to Anatoli Hancharou, Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Anatoli Hancharou

      Andrea Orru added 1 comment

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 620, Patchset 2 (Latest): DCHECK_EQ(request_url, request_.url);
      Adam Rice . unresolved

      The browser process shouldn't DCHECK on data from a lower-privileged process. See https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md#failures-beyond-chromium_s-control

      Also, I don't understand why we are plumbing the URL back from the network service through mojo when we already have it in the browser process. I read the design doc but it didn't explain the reason for doing it.

      Anatoli Hancharou

      This plumbing is actually being added to support a new feature that will be landing in a follow-up CL.

      You are completely right that the existing consumer of `TrustedHeaderClient` (the WebRequest API) already knows the URL because it proxies the entire `URLLoader` and tracks the URL through `CreateLoaderAndStart` and `FollowRedirect`.

      However, to minimize performance overhead, the upcoming Enterprise Header Injection feature is designed to be much more lightweight. It avoids proxying the `URLLoader` pipe entirely, and instead only proxies the `URLLoaderFactory` to attach the `TrustedHeaderClient`.

      Because the `URLLoader` remains unproxied, the browser process does not intercept `OnReceiveRedirect` or `FollowRedirect` for those requests. When a redirect occurs, the Network Service handles it internally and fires another `OnBeforeSendHeaders` to our `TrustedHeaderClient`. Without plumbing `request_url` through this mojo call, our client would have no idea that the URL has changed, and we would end up evaluating enterprise policies against the old pre-redirect URL

      Anatoli Hancharou

      See [InProgressRequest](https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h;bpv=1;bpt=1;l=75?gsn=InProgressRequest&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fchromium.googlesource.com%2Fcodesearch%2Fchromium%2Fsrc%2F%2Fmain%3Flang%3Dc%252B%252B%3Fpath%3Dextensions%2Fbrowser%2Fapi%2Fweb_request%2Fweb_request_proxying_url_loader_factory.h%23NVFF1VzoSJn4J3b894HXJko6TkuMJACrkbDAcnJov4E) implementing `network::mojom::URLLoader`.
      I won't introduce any custom UrlLoader wrappers as the goal is much simpler

      Andrea Orru

      As Adam said you shouldn't DCHECK here.

      If `request_.url` == `request_url`, why don't you just use `request_.url`?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Anatoli Hancharou
      Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 17:24:39 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Jun 11, 2026, 2:28:56 AM (3 days ago) Jun 11
      to Anatoli Hancharou, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Anatoli Hancharou

      Adam Rice added 1 comment

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 620, Patchset 2 (Latest): DCHECK_EQ(request_url, request_.url);
      Adam Rice . unresolved

      The browser process shouldn't DCHECK on data from a lower-privileged process. See https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md#failures-beyond-chromium_s-control

      Also, I don't understand why we are plumbing the URL back from the network service through mojo when we already have it in the browser process. I read the design doc but it didn't explain the reason for doing it.

      Anatoli Hancharou

      This plumbing is actually being added to support a new feature that will be landing in a follow-up CL.

      You are completely right that the existing consumer of `TrustedHeaderClient` (the WebRequest API) already knows the URL because it proxies the entire `URLLoader` and tracks the URL through `CreateLoaderAndStart` and `FollowRedirect`.

      However, to minimize performance overhead, the upcoming Enterprise Header Injection feature is designed to be much more lightweight. It avoids proxying the `URLLoader` pipe entirely, and instead only proxies the `URLLoaderFactory` to attach the `TrustedHeaderClient`.

      Because the `URLLoader` remains unproxied, the browser process does not intercept `OnReceiveRedirect` or `FollowRedirect` for those requests. When a redirect occurs, the Network Service handles it internally and fires another `OnBeforeSendHeaders` to our `TrustedHeaderClient`. Without plumbing `request_url` through this mojo call, our client would have no idea that the URL has changed, and we would end up evaluating enterprise policies against the old pre-redirect URL

      Anatoli Hancharou

      See [InProgressRequest](https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h;bpv=1;bpt=1;l=75?gsn=InProgressRequest&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fchromium.googlesource.com%2Fcodesearch%2Fchromium%2Fsrc%2F%2Fmain%3Flang%3Dc%252B%252B%3Fpath%3Dextensions%2Fbrowser%2Fapi%2Fweb_request%2Fweb_request_proxying_url_loader_factory.h%23NVFF1VzoSJn4J3b894HXJko6TkuMJACrkbDAcnJov4E) implementing `network::mojom::URLLoader`.
      I won't introduce any custom UrlLoader wrappers as the goal is much simpler

      Andrea Orru

      As Adam said you shouldn't DCHECK here.

      If `request_.url` == `request_url`, why don't you just use `request_.url`?

      Adam Rice

      Ah, okay. Please consider making that clearer in the design doc. If this needs to work on Android in future it makes sense not to reuse the existing proxying machinery.

      Also, remove the DCHECK. If you really want a check here, you could do something like
      ```c++
      if constexpr (DCHECK_IS_ON()) {
      if (request_url != request_.url) {
      mojo::ReportBadMessage("URL supplied to OnBeforeSendHeaders() did not match");
      return;
      }
      }
      ```
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anatoli Hancharou
      Gerrit-Comment-Date: Thu, 11 Jun 2026 06:28:42 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Anatoli Hancharou <ant...@google.com>
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      Comment-In-Reply-To: Andrea Orru <andre...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anatoli Hancharou (Gerrit)

      unread,
      Jun 11, 2026, 4:29:56 AM (3 days ago) Jun 11
      to Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrea Orru

      Anatoli Hancharou voted and added 1 comment

      Votes added by Anatoli Hancharou

      Commit-Queue+0

      1 comment

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 620, Patchset 2: DCHECK_EQ(request_url, request_.url);
      Adam Rice . resolved

      The browser process shouldn't DCHECK on data from a lower-privileged process. See https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/checks.md#failures-beyond-chromium_s-control

      Also, I don't understand why we are plumbing the URL back from the network service through mojo when we already have it in the browser process. I read the design doc but it didn't explain the reason for doing it.

      Anatoli Hancharou

      This plumbing is actually being added to support a new feature that will be landing in a follow-up CL.

      You are completely right that the existing consumer of `TrustedHeaderClient` (the WebRequest API) already knows the URL because it proxies the entire `URLLoader` and tracks the URL through `CreateLoaderAndStart` and `FollowRedirect`.

      However, to minimize performance overhead, the upcoming Enterprise Header Injection feature is designed to be much more lightweight. It avoids proxying the `URLLoader` pipe entirely, and instead only proxies the `URLLoaderFactory` to attach the `TrustedHeaderClient`.

      Because the `URLLoader` remains unproxied, the browser process does not intercept `OnReceiveRedirect` or `FollowRedirect` for those requests. When a redirect occurs, the Network Service handles it internally and fires another `OnBeforeSendHeaders` to our `TrustedHeaderClient`. Without plumbing `request_url` through this mojo call, our client would have no idea that the URL has changed, and we would end up evaluating enterprise policies against the old pre-redirect URL

      Anatoli Hancharou

      See [InProgressRequest](https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h;bpv=1;bpt=1;l=75?gsn=InProgressRequest&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fchromium.googlesource.com%2Fcodesearch%2Fchromium%2Fsrc%2F%2Fmain%3Flang%3Dc%252B%252B%3Fpath%3Dextensions%2Fbrowser%2Fapi%2Fweb_request%2Fweb_request_proxying_url_loader_factory.h%23NVFF1VzoSJn4J3b894HXJko6TkuMJACrkbDAcnJov4E) implementing `network::mojom::URLLoader`.
      I won't introduce any custom UrlLoader wrappers as the goal is much simpler

      Andrea Orru

      As Adam said you shouldn't DCHECK here.

      If `request_.url` == `request_url`, why don't you just use `request_.url`?

      Adam Rice

      Ah, okay. Please consider making that clearer in the design doc. If this needs to work on Android in future it makes sense not to reuse the existing proxying machinery.

      Also, remove the DCHECK. If you really want a check here, you could do something like
      ```c++
      if constexpr (DCHECK_IS_ON()) {
      if (request_url != request_.url) {
      mojo::ReportBadMessage("URL supplied to OnBeforeSendHeaders() did not match");
      return;
      }
      }
      ```
      Anatoli Hancharou

      DCHECK removed, thank you!

      I've added a task to expand on mojo modification reasons in the design doc and will address it later this day.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrea Orru
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not 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: I0f680a5876718d160d79cda04a528d45ed61f151
        Gerrit-Change-Number: 7885325
        Gerrit-PatchSet: 3
        Gerrit-Owner: Anatoli Hancharou <ant...@google.com>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Anatoli Hancharou <ant...@google.com>
        Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
        Gerrit-Reviewer: Colin Blundell <blun...@chromium.org>
        Gerrit-Reviewer: Mike West <mk...@chromium.org>
        Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
        Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: Kevin McNee <mc...@chromium.org>
        Gerrit-CC: gwsq
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Attention: Andrea Orru <andre...@chromium.org>
        Gerrit-Comment-Date: Thu, 11 Jun 2026 08:29:24 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Adam Rice (Gerrit)

        unread,
        Jun 12, 2026, 11:42:18 AM (2 days ago) Jun 12
        to Anatoli Hancharou, Code Review Nudger, Chromium IPC Reviews, Mike West, Colin Blundell, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Anatoli Hancharou and Andrea Orru

        Adam Rice voted and added 1 comment

        Votes added by Adam Rice

        Code-Review+1

        1 comment

        Patchset-level comments
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Anatoli Hancharou
        • Andrea Orru
        Gerrit-Attention: Anatoli Hancharou <ant...@google.com>
        Gerrit-Attention: Andrea Orru <andre...@chromium.org>
        Gerrit-Comment-Date: Fri, 12 Jun 2026 15:41:47 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Colin Blundell (Gerrit)

        unread,
        Jun 12, 2026, 12:23:27 PM (2 days ago) Jun 12
        to Anatoli Hancharou, Colin Blundell, Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Anatoli Hancharou and Andrea Orru

        Colin Blundell voted Code-Review+1

        Code-Review+1
        Gerrit-Comment-Date: Fri, 12 Jun 2026 16:23:03 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Andrea Orru (Gerrit)

        unread,
        Jun 12, 2026, 5:00:51 PM (2 days ago) Jun 12
        to Anatoli Hancharou, Colin Blundell, Adam Rice, Code Review Nudger, Chromium IPC Reviews, Mike West, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, James Maclean, chromium-a...@chromium.org, extension...@chromium.org, ipc-securi...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Anatoli Hancharou

        Andrea Orru voted Code-Review+1

        Code-Review+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Anatoli Hancharou
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        Gerrit-Comment-Date: Fri, 12 Jun 2026 21:00:33 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages