[Connection-Allowlist] Enforcing fetch restrictions in the network service [chromium/src : main]

0 views
Skip to first unread message

Cesar Fonseca (Gerrit)

unread,
Nov 2, 2025, 12:16:27 AM (4 days ago) Nov 2
to Shivani Sharma, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
Attention needed from Shivani Sharma

Cesar Fonseca added 1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Shivani Sharma
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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
Gerrit-Change-Number: 7085134
Gerrit-PatchSet: 19
Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
Gerrit-Comment-Date: Sun, 02 Nov 2025 04:16:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Shivani Sharma (Gerrit)

unread,
Nov 2, 2025, 6:13:02 PM (4 days ago) Nov 2
to Mike West, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
Attention needed from Mike West

Shivani Sharma added 1 comment

Patchset-level comments
File-level comment, Patchset 25 (Latest):
Shivani Sharma . resolved

Mike, PTAL, thanks!

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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
Gerrit-Change-Number: 7085134
Gerrit-PatchSet: 25
Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
Gerrit-Reviewer: Mike West <mk...@chromium.org>
Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Mike West <mk...@chromium.org>
Gerrit-Comment-Date: Sun, 02 Nov 2025 23:12:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Shivani Sharma (Gerrit)

unread,
Nov 2, 2025, 6:16:30 PM (4 days ago) Nov 2
to Mike West, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
Attention needed from Mike West

Shivani Sharma added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 19338, Patchset 25 (Latest): // CommitNavigation is sent to the renderer.
Shivani Sharma . unresolved

My understanding is that since this is being sent to the network service before CommitNavigation is sent to the renderer, we are fine with not waiting on a callback. After this the renderer will receive CommitNavigation, process it, send back DidCommitNavigation and only then will use the URLLoaderFactory for fetches. But if there is a chance that the fetch could happen before this is processed by the n/w service, I can add the callback here.

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 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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
    Gerrit-Change-Number: 7085134
    Gerrit-PatchSet: 25
    Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Reviewer: Mike West <mk...@chromium.org>
    Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
    Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Mike West <mk...@chromium.org>
    Gerrit-Comment-Date: Sun, 02 Nov 2025 23:16:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mike West (Gerrit)

    unread,
    Nov 3, 2025, 9:08:18 AM (3 days ago) Nov 3
    to Shivani Sharma, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
    Attention needed from Shivani Sharma

    Mike West added 8 comments

    Patchset-level comments
    Mike West . resolved

    Looks reasonable all in all. I left some high level comments and we can talk about it later in the day.

    File content/browser/renderer_host/render_frame_host_impl.cc
    Line 19340, Patchset 25 (Latest): {{document_associated_data_->token().value(),
    Mike West . unresolved

    1. You're using the `DocumentAssociatedData::token()` for the non-fenced case, and the `FencedFrameProperties::partition_nonce()` otherwise. It's not clear to me how those interact. What if a document in a fenced frame asserts an allowlist?

    2. https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/document_associated_data.h;drc=5be0bdcfcde6f70ecafa6ec854c246d58d3fc21e;l=62 suggests that there might be some cases in which the RFH and Document might disagree about the token, which might turn into a bypass? Looking into the lifetimes here seems necessary if you're going to do the revocation prior to committing the navigation. We might also need to look into things like `Link` headers that can cause requests prior to commit (which y'all probably already poked at for FF)?

    File services/network/cors/cors_url_loader_factory.cc
    Line 443, Patchset 25 (Latest): URLLoaderCompletionStatus(net::ERR_NETWORK_ACCESS_REVOKED));
    Mike West . unresolved

    TODO: Different net error, and probably console issues once we're further along.

    File services/network/network_context.cc
    Line 3507, Patchset 25 (Latest): allowlisted_urls.end());
    Mike West . unresolved

    As noted elsewhere, it seems possible for a fenced frame's document to assert a connection-allowlist, and it doesn't seem like this map would be able to handle that (one would overwrite the other).

    That's not a huge issue for this prototype, but it's not clear to me that this is actually the right structure for the kind of thing we're building. Or maybe the map is fine, but we need to do conflict resolution while building it to make sure that the allowlist that will be checked represents the right set of constraints?

    Line 3654, Patchset 25 (Latest): // For connection allowlist feature, network_revocation_nonces_ contains the
    Mike West . unresolved

    Perhaps wrap all this in ` if (base::FeatureList::IsEnabled(network::features::kConnectionAllowlists)) {`?

    Or `CHECK(base::FeatureList::IsEnabled(network::features::kConnectionAllowlists) || allowlisted_urls.empty())`?

    Line 3662, Patchset 25 (Latest): for (const GURL& allowed_url : allowlisted_urls) {
    Mike West . unresolved

    Nit: Probably worth a comment somewhere (perhaps here and in the mojo file?) that it's intentional that an empty allowlist means all requests should be disallowed. And distinguishing the exception mechanism below, which I'm not familiar with, but doesn't seem like a thing that `connection-allowlist` would take into consideration?

    File services/network/public/mojom/network_context.mojom
    Line 1831, Patchset 25 (Latest): // `allowlisted_urls` and blocked otherwise.
    Mike West . unresolved

    I find this whole comment somewhat confusing, especially now that we're not just dealing with a list of nonces, but a list of pairs of nonces and URLs. I'm not sure it's worth addressing in this CL, but I'd suggest leaving at least a TODO to rename the method now that the control it offers will be substantially more granular: we're not "revoking network access" anymore, we're creating another gate on top of outgoing requests.

    Also, framing things at this layer in terms of "nonces" is certainly technically accurate, but it's not terribly explanatory. I wonder if "network access token" or something would have been clarifying?

    File third_party/blink/renderer/core/frame/connection_allowlist.h
    Line 26, Patchset 25 (Parent):#endif // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_CONNECTION_ALLOWLIST_H_
    Mike West . resolved

    Removing this from Blink for the moment is pretty reasonable, but I do wonder whether we're going to need it or something like it for some of the edge cases we've discussed (devtools-triggered requests, if we end up considering that in scope, as those would be triggered from a distinct context that didn't itself set the policy). Maybe things like favicon as well? I don't recall if those are tied to the page's context or issued from the central cache the browser stores. Y'all have probably looked into these already in the docs I haven't gotten to yet. :)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Shivani Sharma
    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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
    Gerrit-Change-Number: 7085134
    Gerrit-PatchSet: 25
    Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Reviewer: Mike West <mk...@chromium.org>
    Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
    Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Comment-Date: Mon, 03 Nov 2025 14:08:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Shivani Sharma (Gerrit)

    unread,
    Nov 3, 2025, 2:54:00 PM (3 days ago) Nov 3
    to Mike West, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
    Attention needed from Mike West

    Shivani Sharma added 6 comments

    File content/browser/renderer_host/render_frame_host_impl.cc
    Line 19340, Patchset 25: {{document_associated_data_->token().value(),
    Mike West . unresolved

    1. You're using the `DocumentAssociatedData::token()` for the non-fenced case, and the `FencedFrameProperties::partition_nonce()` otherwise. It's not clear to me how those interact. What if a document in a fenced frame asserts an allowlist?

    2. https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/document_associated_data.h;drc=5be0bdcfcde6f70ecafa6ec854c246d58d3fc21e;l=62 suggests that there might be some cases in which the RFH and Document might disagree about the token, which might turn into a bypass? Looking into the lifetimes here seems necessary if you're going to do the revocation prior to committing the navigation. We might also need to look into things like `Link` headers that can cause requests prior to commit (which y'all probably already poked at for FF)?

    Shivani Sharma

    1. To be safe, adding an early return with a TODO from this function if it's a FF tree, so as to not impact FFs with this feature at all. Note that FF's partition_nonce only gets updated if the feature flag is enabled which it is not [1] by default.

    2. IIUC, the renderer gets the same token [2] and this comment suggests that it wouldn't be guaranteed in the renderer until navigation commit. Since we are not using the renderer's token for this feature at the moment, we should be fine. But if for some path, it is used, then it needs to be post-commit.
    Leaving this comment unresolved for navigation owner to confirm that between this point and the commit the document_associated_data_'s token value stays the same for this doc.

    [1]https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=899f4dbefcc1c98a2ddf6564409c9cdc651bd235;l=10811
    [2]https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=35d26d364efb57d0386b98312ba739f7f65ae97e;l=4357

    File services/network/cors/cors_url_loader_factory.cc
    Line 443, Patchset 25: URLLoaderCompletionStatus(net::ERR_NETWORK_ACCESS_REVOKED));
    Mike West . resolved

    TODO: Different net error, and probably console issues once we're further along.

    Shivani Sharma

    Done

    File services/network/network_context.cc
    Line 3507, Patchset 25: allowlisted_urls.end());
    Mike West . resolved

    As noted elsewhere, it seems possible for a fenced frame's document to assert a connection-allowlist, and it doesn't seem like this map would be able to handle that (one would overwrite the other).

    That's not a huge issue for this prototype, but it's not clear to me that this is actually the right structure for the kind of thing we're building. Or maybe the map is fine, but we need to do conflict resolution while building it to make sure that the allowlist that will be checked represents the right set of constraints?

    Shivani Sharma

    Agree that if/when we do allow FFs and this feature to work together, we will need to make sure that a fenced frame only adds one id to this structure.
    Resolving for now since FFs have been checked in the new patch to not add allowlists.

    Line 3654, Patchset 25: // For connection allowlist feature, network_revocation_nonces_ contains the
    Mike West . resolved

    Perhaps wrap all this in ` if (base::FeatureList::IsEnabled(network::features::kConnectionAllowlists)) {`?

    Or `CHECK(base::FeatureList::IsEnabled(network::features::kConnectionAllowlists) || allowlisted_urls.empty())`?

    Shivani Sharma

    Added the check

    Line 3662, Patchset 25: for (const GURL& allowed_url : allowlisted_urls) {
    Mike West . resolved

    Nit: Probably worth a comment somewhere (perhaps here and in the mojo file?) that it's intentional that an empty allowlist means all requests should be disallowed. And distinguishing the exception mechanism below, which I'm not familiar with, but doesn't seem like a thing that `connection-allowlist` would take into consideration?

    Shivani Sharma

    Done

    File services/network/public/mojom/network_context.mojom
    Line 1831, Patchset 25: // `allowlisted_urls` and blocked otherwise.
    Mike West . resolved

    I find this whole comment somewhat confusing, especially now that we're not just dealing with a list of nonces, but a list of pairs of nonces and URLs. I'm not sure it's worth addressing in this CL, but I'd suggest leaving at least a TODO to rename the method now that the control it offers will be substantially more granular: we're not "revoking network access" anymore, we're creating another gate on top of outgoing requests.

    Also, framing things at this layer in terms of "nonces" is certainly technically accurate, but it's not terribly explanatory. I wonder if "network access token" or something would have been clarifying?

    Shivani Sharma

    Added a TODO to rename and also made the comment a bit more clear.

    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 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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
    Gerrit-Change-Number: 7085134
    Gerrit-PatchSet: 28
    Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Reviewer: Mike West <mk...@chromium.org>
    Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
    Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Mike West <mk...@chromium.org>
    Gerrit-Comment-Date: Mon, 03 Nov 2025 19:53:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Mike West <mk...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mike West (Gerrit)

    unread,
    Nov 4, 2025, 10:06:08 AM (2 days ago) Nov 4
    to Shivani Sharma, Alex Moshchuk, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
    Attention needed from Alex Moshchuk and Shivani Sharma

    Mike West voted and added 1 comment

    Votes added by Mike West

    Code-Review+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 28 (Latest):
    Mike West . resolved

    //third_party/blink and mojo LGTM. You'll need a //services/network reviewer to sign off on the new function along with the rest of the network-side changes, but it's fine from a mojo perspective. Thanks for following up!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Shivani Sharma
    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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
      Gerrit-Change-Number: 7085134
      Gerrit-PatchSet: 28
      Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Mike West <mk...@chromium.org>
      Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
      Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
      Gerrit-Comment-Date: Tue, 04 Nov 2025 15:05:52 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Shivani Sharma (Gerrit)

      unread,
      Nov 5, 2025, 3:05:17 PM (18 hours ago) Nov 5
      to Kenichi Ishibashi, Mike West, Alex Moshchuk, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
      Attention needed from Alex Moshchuk and Kenichi Ishibashi

      Shivani Sharma added 1 comment

      Patchset-level comments
      Shivani Sharma . resolved

      bashi@: PTAL, thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Moshchuk
      • Kenichi Ishibashi
      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: I605323e054a70bf1e77f3e42384cb4f19b3feb3e
      Gerrit-Change-Number: 7085134
      Gerrit-PatchSet: 28
      Gerrit-Owner: Shivani Sharma <shiva...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Reviewer: Mike West <mk...@chromium.org>
      Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
      Gerrit-CC: Cesar Fonseca <cesar...@gmail.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Comment-Date: Wed, 05 Nov 2025 20:05:12 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Kenichi Ishibashi (Gerrit)

      unread,
      Nov 5, 2025, 8:07:45 PM (13 hours ago) Nov 5
      to Shivani Sharma, Mike West, Alex Moshchuk, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
      Attention needed from Alex Moshchuk and Shivani Sharma

      Kenichi Ishibashi voted and added 2 comments

      Votes added by Kenichi Ishibashi

      Code-Review+1

      2 comments

      Patchset-level comments
      Kenichi Ishibashi . resolved

      lgtm, thanks!

      File services/network/network_context_unittest.cc
      Line 1120, Patchset 28 (Latest): auto revoked_nonce_url = mojom::NonceAndAllowlistedUrls::New();
      revoked_nonce_url->nonce = revoked_nonce;
      std::vector<network::mojom::NonceAndAllowlistedUrlsPtr> nonces_to_urls;
      nonces_to_urls.push_back(std::move(revoked_nonce_url));
      Kenichi Ishibashi . unresolved

      nit: We may consider adding a helper function to create `NonceAndAllowlistedUrls`.

      ```c++
      mojom::NonceAndAllowListedUrlsPtr CreateAllowListedUrls(const std::array<base::UnguessableToken> nonces) { ... }
      ```

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Moshchuk
      • Shivani Sharma
      Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
      Gerrit-Comment-Date: Thu, 06 Nov 2025 01:07:10 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Moshchuk (Gerrit)

      unread,
      Nov 5, 2025, 9:53:08 PM (11 hours ago) Nov 5
      to Shivani Sharma, Kenichi Ishibashi, Mike West, Cesar Fonseca, Nate Chapin, James Maclean, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, blink-revi...@chromium.org, gavinp...@chromium.org, blink-...@chromium.org, loading...@chromium.org, fenced-fra...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, ipc-securi...@chromium.org, navigation...@chromium.org, network-ser...@chromium.org
      Attention needed from Shivani Sharma

      Alex Moshchuk added 8 comments

      Patchset-level comments
      Alex Moshchuk . resolved

      Thanks, this is an interesting feature proposal! I've posted some comments and questions below, and also we wanted to discuss this in our weekly CSA sync next Tue, so I might have more feedback then. I realize this is a prototype and not everything might need to be done in this CL, so feel free to push back against any of these if you're planning to eventually get to them. :)

      File content/browser/renderer_host/document_associated_data.cc
      Line 86, Patchset 28 (Latest): if (GetWeakPtr() && !token_->is_empty()) {
      Alex Moshchuk . unresolved

      Is it really possible for the DUD to go away here? It seems that if that were to happen, we'd crash on line 96 below?

      Line 89, Patchset 28 (Latest): storage_partition->ClearNoncesInNetworkContextAfterDelay({
      Alex Moshchuk . unresolved

      Is this delay big enough to deal with races where a frame might a fetch keepalive request and then destroys itself, setting up a race where the fetch eventually succeeds? I'm not sure whether there are new considerations here compared to fenced frames.

      File content/browser/renderer_host/render_frame_host_impl.cc
      Line 12968, Patchset 28 (Latest): subresource_loader_factories =
      Alex Moshchuk . unresolved

      This path also sends a commit IPC but for error pages. I wouldn't expect error pages to make network requests, but it seems that they do create subresource URLLoaderFactories here. Would this also need to enforce the network restrictions?

      Line 19318, Patchset 28 (Latest):void RenderFrameHostImpl::ApplyNetworkRestrictionsIfNeeded(
      Alex Moshchuk . unresolved

      I wonder if you also need to call this when new frames get created without navigations. Otherwise, it seems that a frame could bypass its network restrictions by just creating a blank subframe (which would have a fresh document token) and inject a script into it to do a fetch without ever navigating it. (Same concern for window.open().) Or maybe the renderer reuses the parent's URLLoaderFactory (with the original token) for the child in that case? It'd be good to eventually have a test for this.

      Line 19338, Patchset 25: // CommitNavigation is sent to the renderer.
      Shivani Sharma . unresolved

      My understanding is that since this is being sent to the network service before CommitNavigation is sent to the renderer, we are fine with not waiting on a callback. After this the renderer will receive CommitNavigation, process it, send back DidCommitNavigation and only then will use the URLLoaderFactory for fetches. But if there is a chance that the fetch could happen before this is processed by the n/w service, I can add the callback here.

      Alex Moshchuk

      I think the following race might still be possible here:
      1. Browser sends CommitNavigation to the renderer
      2. Browser sends RevokeNetworkForNonces to the NS
      3. Renderer process receives and processes CommitNavigation, sends back DidCommitNavigation, starts loading the document and executing its scripts.
      4. Those scripts trigger a network fetch from the renderer process to NS via its subresource URLLoaderFactory
      5. The network fetch arrives to the NS process, which hasn't received the nonces yet.
      6. RevokeNetworkForNonces arrives in the NS process, too late to take effect.

      In other words, I don't see anything that would guarantee that an IPC from browser process to NS would arrive sooner than an IPC from browser to renderer, followed by an IPC from renderer to NS.

      So I think we do want to do something here. I'm not sure about waiting for a callback, since this is on a critical path for navigations and could slow things down, though maybe it's ok in the short term if it's just for prototyping and behind your feature flag. Maybe another approach to consider could be for the NS to query the browser process about a newly seen nonce when it sees a fetch from a new frame, to see what kinds of restrictions that nonce should have, if any (and verify that that frame is still active)?

      Line 19340, Patchset 25: {{document_associated_data_->token().value(),
      Mike West . unresolved

      1. You're using the `DocumentAssociatedData::token()` for the non-fenced case, and the `FencedFrameProperties::partition_nonce()` otherwise. It's not clear to me how those interact. What if a document in a fenced frame asserts an allowlist?

      2. https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/document_associated_data.h;drc=5be0bdcfcde6f70ecafa6ec854c246d58d3fc21e;l=62 suggests that there might be some cases in which the RFH and Document might disagree about the token, which might turn into a bypass? Looking into the lifetimes here seems necessary if you're going to do the revocation prior to committing the navigation. We might also need to look into things like `Link` headers that can cause requests prior to commit (which y'all probably already poked at for FF)?

      Shivani Sharma

      1. To be safe, adding an early return with a TODO from this function if it's a FF tree, so as to not impact FFs with this feature at all. Note that FF's partition_nonce only gets updated if the feature flag is enabled which it is not [1] by default.

      2. IIUC, the renderer gets the same token [2] and this comment suggests that it wouldn't be guaranteed in the renderer until navigation commit. Since we are not using the renderer's token for this feature at the moment, we should be fine. But if for some path, it is used, then it needs to be post-commit.
      Leaving this comment unresolved for navigation owner to confirm that between this point and the commit the document_associated_data_'s token value stays the same for this doc.

      [1]https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=899f4dbefcc1c98a2ddf6564409c9cdc651bd235;l=10811
      [2]https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=35d26d364efb57d0386b98312ba739f7f65ae97e;l=4357

      Alex Moshchuk

      Sorry, I haven't had to deal with this token in a while, so had to do a bit of digging around. In general, we seem to restrict access to this token behind [these getters](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.h;l=617-635;drc=1563510976ec6765127e5d1326d37a2b0c0fb140), which warn against accessing it during pending commit, which is exactly the stage where you're using it here. It's worth reading through the [CL description](https://chromium-review.googlesource.com/c/chromium/src/+/3849601) where we introduced this (and [this followup](https://chromium-review.googlesource.com/c/chromium/src/+/3913999)) and thinking whether any of the quirks mentioned there could affect connection allowlists.

      I do think that document_associated_data_'s token should stay the same between being constructed for a speculative RFH and the navigation commit (and for that matter, DidCommit as well). So this case should be ok here.

      If the RFH was reused for a new cross-document navigation (only the case without RenderDocument, which we still haven't fully shipped, though that's hopefully coming soon), then document_associated_data_'s token is [updated](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;l=15830;drc=1563510976ec6765127e5d1326d37a2b0c0fb140) at DidCommit time. Have you checked how that case works with your feature? It seems the token may not be correct in that case, and you might need to use the one from NavigationRequest.

      More generally, I agree with Mike's concern that it seems fragile that the renderer can bypass the protection by finding a way to send a network request out with a token that doesn't match with the one here, which seems easier to do with a token that's per-document instead of per-StoragePartition. E.g., what about requests from workers? What about requests made by scripting same-origin frames that might not have network restrictions? Would the latter suggest that the token granularity should be SiteInstance rather than Document? Or maybe there are arguments for why this is robust maybe based on how the URLLoaderFactories are managed in the renderer, or how network requests in blink would determine the token to pass to NS?

      File services/network/network_context.cc
      Line 3651, Patchset 28 (Latest): return true;
      Alex Moshchuk . unresolved

      Just curious: have you thought at all what it would take to make this fail closed by default, where there's no network access unless a nonce has been explicitly registered without restrictions?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Shivani Sharma
      Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
      Gerrit-Comment-Date: Thu, 06 Nov 2025 02:52:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Shivani Sharma <shiva...@chromium.org>
      Comment-In-Reply-To: Mike West <mk...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages