Validate file uploads using unguessable tokens [chromium/src : main]

0 views
Skip to first unread message

Nidhi Jaju (Gerrit)

unread,
May 27, 2026, 7:07:42 AMMay 27
to Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
Attention needed from Kenichi Ishibashi

Nidhi Jaju added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Nidhi Jaju . resolved

Hi Bashi-san, could you help review this? Some of the reasoning for this change is in the linked bug. There's still a few failing tests, but I think they are largely unrelated to the change, so I wanted to get your thoughts on the overall approach. Thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Kenichi Ishibashi
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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
Gerrit-Change-Number: 7878365
Gerrit-PatchSet: 1
Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
Gerrit-Comment-Date: Wed, 27 May 2026 11:07:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Kenichi Ishibashi (Gerrit)

unread,
May 28, 2026, 3:59:29 AMMay 28
to Nidhi Jaju, Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Nidhi Jaju and Takashi Toyoshima

Kenichi Ishibashi added 11 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Kenichi Ishibashi . resolved

Took a first round look. This approach was discussed in https://crbug.com/497428001.

toyoshim@: Does this approach look reasonable? I want to hear your thoughts since you have worked on IPC related stuff especially for the network service.
horoshige@: You've been working on URLLoaderFactory so I want to hear your thoughts too.
alexmos@: What do you think about this approach from the perspective of //content/browser/CHILD_PROCESS_SECURITY_POLICY_OWNERS?

File content/browser/child_process_security_policy_impl.h
Line 1242, Patchset 2 (Latest): base::flat_map<base::UnguessableToken, base::FilePath> browser_upload_tokens_
Kenichi Ishibashi . unresolved

Please fix this WARNING reported by autoreview issue finding:

---

Entries added to `browser_upload_tokens_` are never removed. This causes a memory leak that will grow for the lifetime of the browser process for every browser-initiated file upload.

Should there be a mechanism to revoke these tokens when the upload finishes, or perhaps an expiration mechanism for this map?

---

Using an LRU cache might be an option, but I'm not sure how we can guarantee that all necessary entries are kept alive.

Line 1242, Patchset 2 (Latest): base::flat_map<base::UnguessableToken, base::FilePath> browser_upload_tokens_
Kenichi Ishibashi . unresolved

Please add a comment explaining what this field is used for.

Line 211, Patchset 2 (Latest): void RegisterUploadToken(ChildProcessId child_id,
const base::UnguessableToken& token,
const base::FilePath& file_path);
bool ValidateUploadToken(ChildProcessId child_id,
const base::UnguessableToken& token,
const base::FilePath& file_path);
Kenichi Ishibashi . unresolved

These are not ChildProcessSecurityPolicy implementations so we should move somewhere else.

Also, please add comments explaining what these methods do.

File content/browser/child_process_security_policy_impl.cc
Line 926, Patchset 2 (Latest): bool ValidateUploadToken(const base::UnguessableToken& token,
Kenichi Ishibashi . unresolved

Please fix this WARNING reported by autoreview issue finding: This method should be marked `const` so it can be called via `GetSecurityStateForQuery()` in `ChildProcessSecurityPolicyImpl::ValidateUploadToken()`.

Line 1037, Patchset 2 (Latest): base::flat_map<base::UnguessableToken, base::FilePath> upload_tokens_;
Kenichi Ishibashi . unresolved

Probably the same thing can be (memory leak) said for this?

Line 1884, Patchset 2 (Latest): auto* state = security_states_.GetSecurityStateForMutation(child_id);
Kenichi Ishibashi . unresolved

Please fix this WARNING reported by autoreview issue finding: For query operations, it's safer to use `GetSecurityStateForQuery(child_id)`.

`GetSecurityStateForMutation` intentionally returns null if the process is in `pending_remove_state_` (e.g., if the process is tearing down but an IO task is still resolving). Using it here could cause spurious validation failures during process shutdown.

You will also need to mark `SecurityState::ValidateUploadToken` as `const`.

File content/browser/loader/browser_process_url_loader_factory.cc
Line 53, Patchset 2 (Latest): *mutable_request.request_body->elements_mutable()) {
Kenichi Ishibashi . unresolved

Please fix this WARNING reported by autoreview issue finding:

`mutable_request.request_body` is a `scoped_refptr<ResourceRequestBody>`. Because it's `RefCountedThreadSafe`, mutating it in place via `elements_mutable()` modifies the underlying object which might be shared across multiple requests (e.g., during retries or multiple fetch calls).

You should create a new `ResourceRequestBody`, clone the elements into it, inject the tokens on the cloned file elements, copy over properties like `identifier_` and `contains_sensitive_info_`, and finally replace `mutable_request.request_body` with the new instance.

File content/browser/network_context_client_base_impl.cc
Line 48, Patchset 2 (Latest): process_id.is_browser()
Kenichi Ishibashi . unresolved

Please fix this WARNING reported by autoreview issue finding: If `process_id.is_browser()` is true and there is no token, this will call `cpsp->CanReadFile(ChildProcessId(), file_path)`. Since there is no security state for a null `ChildProcessId`, this will always return `false`.

If the intention is to fail browser requests without a token, it might be clearer to explicitly write `validation_success = !process_id.is_browser() && cpsp->CanReadFile(...)`.

If the intention is to allow browser requests without a token (as the original code did), use `validation_success = process_id.is_browser() || cpsp->CanReadFile(...)`.

File content/browser/storage_partition_impl.cc
Line 3694, Patchset 2 (Latest): *out_factory = WrapBrowserProcessURLLoaderFactory(std::move(target_factory));
Kenichi Ishibashi . unresolved

I felt that creating a wrapped URLLoaderFactory every time might be a bit excessive. I don't have any specific ideas, but I'm wondering if there are other approaches.

toyoshim@, hiroshige@: Can I ask your opinion on this?

File services/network/public/mojom/network_context_client.mojom
Line 14, Patchset 2 (Latest):struct FileUploadRequest {
Kenichi Ishibashi . unresolved

Please add a doc comment (struct itself, each field).

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Moshchuk
  • Hiroshige Hayashizaki
  • Nidhi Jaju
  • Takashi Toyoshima
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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 2
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Thu, 28 May 2026 07:59:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    May 28, 2026, 5:52:42 AMMay 28
    to Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 10 comments

    File content/browser/child_process_security_policy_impl.h
    Line 1242, Patchset 2: base::flat_map<base::UnguessableToken, base::FilePath> browser_upload_tokens_
    Kenichi Ishibashi . resolved

    Please fix this WARNING reported by autoreview issue finding:

    ---

    Entries added to `browser_upload_tokens_` are never removed. This causes a memory leak that will grow for the lifetime of the browser process for every browser-initiated file upload.

    Should there be a mechanism to revoke these tokens when the upload finishes, or perhaps an expiration mechanism for this map?

    ---

    Using an LRU cache might be an option, but I'm not sure how we can guarantee that all necessary entries are kept alive.

    Nidhi Jaju

    Done

    Line 1242, Patchset 2: base::flat_map<base::UnguessableToken, base::FilePath> browser_upload_tokens_
    Kenichi Ishibashi . resolved

    Please add a comment explaining what this field is used for.

    Nidhi Jaju

    Done

    Line 211, Patchset 2: void RegisterUploadToken(ChildProcessId child_id,

    const base::UnguessableToken& token,
    const base::FilePath& file_path);
    bool ValidateUploadToken(ChildProcessId child_id,
    const base::UnguessableToken& token,
    const base::FilePath& file_path);
    Kenichi Ishibashi . resolved

    These are not ChildProcessSecurityPolicy implementations so we should move somewhere else.

    Also, please add comments explaining what these methods do.

    Nidhi Jaju

    Done

    File content/browser/child_process_security_policy_impl.cc
    Line 926, Patchset 2: bool ValidateUploadToken(const base::UnguessableToken& token,
    Kenichi Ishibashi . resolved

    Please fix this WARNING reported by autoreview issue finding: This method should be marked `const` so it can be called via `GetSecurityStateForQuery()` in `ChildProcessSecurityPolicyImpl::ValidateUploadToken()`.

    Nidhi Jaju

    Done

    Line 1037, Patchset 2: base::flat_map<base::UnguessableToken, base::FilePath> upload_tokens_;
    Kenichi Ishibashi . resolved

    Probably the same thing can be (memory leak) said for this?

    Nidhi Jaju

    Added a comment about why this is tied to the lifetime of the renderer process.

    Line 1884, Patchset 2: auto* state = security_states_.GetSecurityStateForMutation(child_id);
    Kenichi Ishibashi . resolved

    Please fix this WARNING reported by autoreview issue finding: For query operations, it's safer to use `GetSecurityStateForQuery(child_id)`.

    `GetSecurityStateForMutation` intentionally returns null if the process is in `pending_remove_state_` (e.g., if the process is tearing down but an IO task is still resolving). Using it here could cause spurious validation failures during process shutdown.

    You will also need to mark `SecurityState::ValidateUploadToken` as `const`.

    Nidhi Jaju

    Done

    File content/browser/loader/browser_process_url_loader_factory.cc
    Line 53, Patchset 2: *mutable_request.request_body->elements_mutable()) {
    Kenichi Ishibashi . resolved

    Please fix this WARNING reported by autoreview issue finding:

    `mutable_request.request_body` is a `scoped_refptr<ResourceRequestBody>`. Because it's `RefCountedThreadSafe`, mutating it in place via `elements_mutable()` modifies the underlying object which might be shared across multiple requests (e.g., during retries or multiple fetch calls).

    You should create a new `ResourceRequestBody`, clone the elements into it, inject the tokens on the cloned file elements, copy over properties like `identifier_` and `contains_sensitive_info_`, and finally replace `mutable_request.request_body` with the new instance.

    Nidhi Jaju

    Done

    File content/browser/network_context_client_base_impl.cc
    Line 48, Patchset 2: process_id.is_browser()
    Kenichi Ishibashi . resolved

    Please fix this WARNING reported by autoreview issue finding: If `process_id.is_browser()` is true and there is no token, this will call `cpsp->CanReadFile(ChildProcessId(), file_path)`. Since there is no security state for a null `ChildProcessId`, this will always return `false`.

    If the intention is to fail browser requests without a token, it might be clearer to explicitly write `validation_success = !process_id.is_browser() && cpsp->CanReadFile(...)`.

    If the intention is to allow browser requests without a token (as the original code did), use `validation_success = process_id.is_browser() || cpsp->CanReadFile(...)`.

    Nidhi Jaju

    Done

    File content/browser/storage_partition_impl.cc
    Line 3694, Patchset 2: *out_factory = WrapBrowserProcessURLLoaderFactory(std::move(target_factory));
    Kenichi Ishibashi . unresolved

    I felt that creating a wrapped URLLoaderFactory every time might be a bit excessive. I don't have any specific ideas, but I'm wondering if there are other approaches.

    toyoshim@, hiroshige@: Can I ask your opinion on this?

    Nidhi Jaju

    This design follows a common pattern for intercepting or auditing requests at the browser boundary. Other examples of URLLoaderFactory wrappers in the browser process include:

    • Extensions WebRequest API: extensions::WebRequestProxyingURLLoaderFactory intercepts and rewrites headers.
    • Safe Browsing Interception: safe_browsing::ProxyURLLoaderFactory scans requests at the factory level.
    • DevTools Network Emulation: content::DevToolsURLLoaderFactory injects latency or mocks failures.
    • Offline Pages: offline_pages::OfflinePageURLLoaderFactory loads cached pages.
    • Wrapping the factory here allows us to securely bind upload tokens to browser-initiated requests at the API boundary, without modifying each individual client.

    Alternatives considered:

    • Modifying Network Service URLLoaderFactory directly: Not viable because the Network Service is sandboxed and cannot be trusted to self-register tokens.
    • Modifying individual browser call sites: Not preferred as it would be fragile to update every browser-process component that uploads files.
    File services/network/public/mojom/network_context_client.mojom
    Line 14, Patchset 2:struct FileUploadRequest {
    Kenichi Ishibashi . resolved

    Please add a doc comment (struct itself, each field).

    Nidhi Jaju

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 4
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Thu, 28 May 2026 09:52:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kenichi Ishibashi <ba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Hiroshige Hayashizaki (Gerrit)

    unread,
    May 28, 2026, 10:34:34 PM (13 days ago) May 28
    to Nidhi Jaju, Takashi Toyoshima, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Kenichi Ishibashi and Takashi Toyoshima

    Hiroshige Hayashizaki added 1 comment

    File content/browser/storage_partition_impl.cc
    Line 3694, Patchset 2: *out_factory = WrapBrowserProcessURLLoaderFactory(std::move(target_factory));
    Kenichi Ishibashi . unresolved

    I felt that creating a wrapped URLLoaderFactory every time might be a bit excessive. I don't have any specific ideas, but I'm wondering if there are other approaches.

    toyoshim@, hiroshige@: Can I ask your opinion on this?

    Nidhi Jaju

    This design follows a common pattern for intercepting or auditing requests at the browser boundary. Other examples of URLLoaderFactory wrappers in the browser process include:

    • Extensions WebRequest API: extensions::WebRequestProxyingURLLoaderFactory intercepts and rewrites headers.
    • Safe Browsing Interception: safe_browsing::ProxyURLLoaderFactory scans requests at the factory level.
    • DevTools Network Emulation: content::DevToolsURLLoaderFactory injects latency or mocks failures.
    • Offline Pages: offline_pages::OfflinePageURLLoaderFactory loads cached pages.
    • Wrapping the factory here allows us to securely bind upload tokens to browser-initiated requests at the API boundary, without modifying each individual client.

    Alternatives considered:

    • Modifying Network Service URLLoaderFactory directly: Not viable because the Network Service is sandboxed and cannot be trusted to self-register tokens.
    • Modifying individual browser call sites: Not preferred as it would be fragile to update every browser-process component that uploads files.
    Hiroshige Hayashizaki

    My gut feeling is: we should modify the body BEFORE sending a `network::ResourceRequest` at the call site of the request initiator, instead of intercepting requests in the middle of network loading (i.e. preferring your "Modifying individual browser call sites" option), because

    • This will provide clearer view for who provides the unguessable token and for what purpose.
    • This will avoid adding a new interceptor for all requests.
    • I assume there are very limited number of call sites that actually need modifying (one or two?), while I don't know anything specific yet.

    So my next question is: if we would proceed to this way, which call sites would be modified?

    As for interception point (if we would proceed to the interceptor approach):

    This (`StoragePartitionImpl::CreateURLLoaderFactoryForBrowserProcessInternal()`) is NOT the catch-all point to apply an interceptor for all browser-initiated requests. For example, `NavigationURLLoaderImpl::CreateURLLoaderFactoryWithHeaderClient()` doesn't go through this.
    You mentioned `WebRequestProxyingURLLoaderFactory` etc., but they go through `ContentBrowserClient::WillCreateURLLoaderFactory()`, not here.
    `ContentBrowserClient::WillCreateURLLoaderFactory()` have broader coverage (e.g.
    `NavigationURLLoaderImpl::CreateURLLoaderFactoryWithHeaderClient()` still goes through `ContentBrowserClient::WillCreateURLLoaderFactory()`, while still not ALL browser-process-initiated requests go though `WillCreateURLLoaderFactory()` -- see the figure in https://docs.google.com/document/d/1oN3vkIgs76-KUO00rLTgYfploKz7MpDPBqgUUzxWupE/edit?tab=t.0#bookmark=id.c1ihcvsx6bkn ).
    So, aligning with the reasoning above, I feel we should add the new interceptor through `WillCreateURLLoaderFactory()`, not here, while I'm not a big fan of `WillCreateURLLoaderFactory()`.
    This would also remove the duplicated calls to `WrapBrowserProcessURLLoaderFactory()`.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 5
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 02:34:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kenichi Ishibashi <ba...@chromium.org>
    Comment-In-Reply-To: Nidhi Jaju <nidh...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    May 29, 2026, 4:19:01 AM (13 days ago) May 29
    to Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 1 comment

    File content/browser/storage_partition_impl.cc
    Nidhi Jaju

    Good point about the navigation requests with a `header_client` (e.g., when DevTools is open), they indeed bypass the wrapped browser factory. We can handle the navigations by registering upload tokens directly at the call sites (see below).

    More broadly, there are four main ways content is uploaded from the browser process:

    1. Google APIs (Drive Uploads): Uses `AttachFileForUpload()` with a file path in `UrlFetchRequestBase::StartAfterPrepare()`. Directly modifying this initiator is complicated because `google_apis` is prohibited by `google_apis/DEPS` from depending on `content/`, so it cannot call `ChildProcessSecurityPolicy` directly. Plumbing a token-registration callback from `//chrome/browser` through `RequestSender` down to `UrlFetchRequestBase` would touch dozens of files and add significant complexity.
    2. Web Share Target (Navigation): Constructs file ranges in `//chrome/browser` for POST navigations. We can register tokens directly at these call sites (`share_target_utils.cc` and `webapk_post_share_target_navigator.cc`) since they are already in `//chrome/browser`.
    3. Safe Browsing Deep Scanning (Enterprise Connectors): Maps files in the browser and streams them over a Mojo data pipe (`ConnectorDataPipeGetter`) instead of using raw `URLLoader` file elements, so it doesn't need upload tokens.
    4. System / Feedback / Telemetry: Uploads string/bytes directly from memory using `AttachStringForUpload()`, so no file upload tokens are needed.

    To reduce duplicate calls to `WrapBrowserProcessURLLoaderFactory`, we can choose to leave out wrapping for the Safe Browsing and System contexts. Since they do not perform raw file uploads today, covering them is optional for this CL. If omitted, future developers attempting uploads on those contexts will encounter `ERR_ACCESS_DENIED` until they manually wrap the factory or register tokens.

    Ultimately, automatically registering tokens at the factory boundary is safe because the browser process is fully trusted. If the browser sets up a request with a file path, it has explicitly chosen to upload it. The token simply acts as cryptographic proof to `NetworkContextClient` that the upload was authorized by the trusted browser process.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 08:18:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Hiroshige Hayashizaki <hiro...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kenichi Ishibashi (Gerrit)

    unread,
    Jun 1, 2026, 2:22:16 AM (10 days ago) Jun 1
    to Nidhi Jaju, Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Nidhi Jaju and Takashi Toyoshima

    Kenichi Ishibashi added 4 comments

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Kenichi Ishibashi . resolved

    Just leaving some comments. I'd like to hear other reviewers' opinion about the overall approach.

    File content/browser/child_process_security_policy_impl.cc
    Line 923, Patchset 7 (Latest): upload_tokens_[token] = {file_path, base::TimeTicks::Now()};
    Kenichi Ishibashi . unresolved

    Can still grow unconditionally?

    Line 1868, Patchset 7 (Latest): base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . unresolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    File content/browser/loader/browser_process_url_loader_factory.cc
    Line 53, Patchset 7 (Latest): bool has_files = false;
    for (const network::DataElement& element :
    *mutable_request.request_body->elements()) {
    if (element.type() == network::mojom::DataElementDataView::Tag::kFile) {
    has_files = true;
    break;
    }
    }
    Kenichi Ishibashi . unresolved
    How about:
    ```c++
    bool has_files = std::ranges::any_of(
    *mutable_request.request_body->elements(), [](const network::DataElement& element) {
    return element.type() ==
    network::mojom::DataElementDataView::Tag::kFile;
    });
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Nidhi Jaju
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 7
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Jun 2026 06:21:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    Jun 1, 2026, 3:41:38 AM (10 days ago) Jun 1
    to Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 3 comments

    File content/browser/child_process_security_policy_impl.cc
    Line 923, Patchset 7: upload_tokens_[token] = {file_path, base::TimeTicks::Now()};
    Kenichi Ishibashi . unresolved

    Can still grow unconditionally?

    Nidhi Jaju

    Entries in `upload_tokens_` have the same lifetime as the existing `file_permissions_`, they are tied to the `SecurityState` associated with the renderer process. This ensures that they last for the lifetime of the renderer process and are cleaned up when no longer needed.

    Line 1868, Patchset 7: base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . unresolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    Nidhi Jaju
    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?

    Memory usage here should scale with the number of file uploads that are occurring, so doing more uploads will take more memory, but that has always been the case (there will be a number of other objects that scale with the number of uploads, and this isn't meaningfully adding to that bloat).

    • it's possible that the token might be lost if the upload takes a long time?

    If you request an upload, but then don't start actually performing that upload for 10 minutes, then it's technically possible for the permission to expire. However, I did an audit of all of the relevant codepaths and did not find any places where we'll significantly delay starting the upload. Even if the network is slow, it doesn't matter if the upload takes more than 10 minutes, the time that matters is how long after token creation you start the upload.

    File content/browser/loader/browser_process_url_loader_factory.cc
    Line 53, Patchset 7: bool has_files = false;

    for (const network::DataElement& element :
    *mutable_request.request_body->elements()) {
    if (element.type() == network::mojom::DataElementDataView::Tag::kFile) {
    has_files = true;
    break;
    }
    }
    Kenichi Ishibashi . resolved
    How about:
    ```c++
    bool has_files = std::ranges::any_of(
    *mutable_request.request_body->elements(), [](const network::DataElement& element) {
    return element.type() ==
    network::mojom::DataElementDataView::Tag::kFile;
    });
    ```
    Nidhi Jaju

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 8
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Jun 2026 07:41:15 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kenichi Ishibashi <ba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    Jun 2, 2026, 5:28:27 AM (9 days ago) Jun 2
    to Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 1 comment

    File content/browser/storage_partition_impl.cc
    Line 3694, Patchset 2: *out_factory = WrapBrowserProcessURLLoaderFactory(std::move(target_factory));
    Kenichi Ishibashi . resolved
    Nidhi Jaju

    I've removed the wrapped URLLoaderFactory in favor of setting a token registration callback in the latest patchset, please take a look.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 9
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Tue, 02 Jun 2026 09:28:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Toyoshima (Gerrit)

    unread,
    Jun 2, 2026, 10:32:36 PM (8 days ago) Jun 2
    to Nidhi Jaju, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki and Kenichi Ishibashi

    Takashi Toyoshima added 9 comments

    Patchset-level comments
    File-level comment, Patchset 11 (Latest):
    Takashi Toyoshima . resolved

    latter files are not yet reviewed, but let me publish tentatively.

    File chrome/browser/web_share_target/target_util.cc
    Line 59, Patchset 11 (Latest): request_body->AppendFileRange(file_path, 0, -1, base::Time(), upload_token);
    Takashi Toyoshima . unresolved

    `/*expected_modification_time=*/base=::Time()`

    Line 59, Patchset 11 (Latest): request_body->AppendFileRange(file_path, 0, -1, base::Time(), upload_token);
    Takashi Toyoshima . unresolved

    `/*offset=*/0`

    Line 59, Patchset 11 (Latest): request_body->AppendFileRange(file_path, 0, -1, base::Time(), upload_token);
    Takashi Toyoshima . unresolved

    `/*length=*/-1`

    File content/browser/child_process_security_policy_impl.h
    Line 730, Patchset 11 (Latest): base::TimeTicks creation_time;
    Takashi Toyoshima . unresolved

    registration_time? `creation_time` for file_path is a bit confusing.

    File content/browser/child_process_security_policy_impl.cc
    Line 923, Patchset 7: upload_tokens_[token] = {file_path, base::TimeTicks::Now()};
    Kenichi Ishibashi . unresolved

    Can still grow unconditionally?

    Nidhi Jaju

    Entries in `upload_tokens_` have the same lifetime as the existing `file_permissions_`, they are tied to the `SecurityState` associated with the renderer process. This ensures that they last for the lifetime of the renderer process and are cleaned up when no longer needed.

    Takashi Toyoshima

    NavigationURLLoader case can be unregistered explicitly, but subresurce request cases are considerable here, but as we did the similar thing for file_path before, it would be ok.

    Line 1045, Patchset 11 (Latest): base::flat_map<base::UnguessableToken, UploadTokenInfo> upload_tokens_;
    Takashi Toyoshima . unresolved

    just file_path is enough for the child process initiator cases?

    Line 1137, Patchset 11 (Latest): // Set the callback for SimpleURLLoader to automatically register unguessable
    // upload tokens for browser-initiated requests. The
    // ChildProcessSecurityPolicyImpl constructor runs exactly once very early on
    // the UI thread during startup, ensuring thread-safe registration before any
    // network requests can be processed.
    network::SimpleURLLoader::SetUploadTokenRegisterCallback(base::BindRepeating(
    [](const base::UnguessableToken& token, const base::FilePath& path) {
    ChildProcessSecurityPolicyImpl::GetInstance()->RegisterUploadToken(
    ChildProcessId(), token, path);
    }));
    Takashi Toyoshima . unresolved

    Well... technically said, this correctly handles the required layering dependency. But as the Rust version of this component is under experiments, this dependency might matter, and it might be better to have this callback registration outside this constructor, besides the ctor's call site.
    creis@ is the best to ask?

    Line 1868, Patchset 7: base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . unresolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    Nidhi Jaju
    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?

    Memory usage here should scale with the number of file uploads that are occurring, so doing more uploads will take more memory, but that has always been the case (there will be a number of other objects that scale with the number of uploads, and this isn't meaningfully adding to that bloat).

    • it's possible that the token might be lost if the upload takes a long time?

    If you request an upload, but then don't start actually performing that upload for 10 minutes, then it's technically possible for the permission to expire. However, I did an audit of all of the relevant codepaths and did not find any places where we'll significantly delay starting the upload. Even if the network is slow, it doesn't matter if the upload takes more than 10 minutes, the time that matters is how long after token creation you start the upload.

    Takashi Toyoshima

    Is it possible to unregister explicitly?
    Maybe called from the destructor, callback, or something like that of NavigationURLLoader and SimpleURLLoader?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 11
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Wed, 03 Jun 2026 02:32:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Toyoshima (Gerrit)

    unread,
    Jun 2, 2026, 10:56:41 PM (8 days ago) Jun 2
    to Nidhi Jaju, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Nidhi Jaju

    Takashi Toyoshima added 10 comments

    Patchset-level comments
    Takashi Toyoshima . resolved

    reviewed on non-testing files.
    so, my first interaction is done.
    I will take another look after another patch set is uploaded.

    File content/browser/network_context_client_base_impl.cc
    Line 48, Patchset 11 (Latest): validation_success =
    Takashi Toyoshima . unresolved
    I think what you want here is
    ```
    !base::FeatureList::IsEnabled(...) && (
    process_id.is_browser() ||
    (!process_id.is_browser() && cpsp->CanReadFile())
    )
    ```
    As we always want the token in the new mode?
    File services/network/file_opener_for_upload.h
    Line 21, Patchset 11 (Latest):#include "base/unguessable_token.h"
    Takashi Toyoshima . unresolved

    wrong include place.

    File services/network/file_opener_for_upload.cc
    Line 9, Patchset 11 (Latest):#include "base/unguessable_token.h"
    Takashi Toyoshima . unresolved

    dup, already included in the header side.

    File services/network/public/cpp/simple_url_loader.h
    Line 197, Patchset 11 (Latest): using UploadTokenRegisterCallback =
    base::RepeatingCallback<void(const base::UnguessableToken&,
    const base::FilePath&)>;
    Takashi Toyoshima . unresolved
    File services/network/public/cpp/simple_url_loader.cc
    Line 2109, Patchset 11 (Latest):SimpleURLLoader::~SimpleURLLoader() {}
    Takashi Toyoshima . unresolved

    Please fix this WARNING reported by ClangTidy: check: modernize-use-equals-default

    use '= default' to define a trivial destruc...

    check: modernize-use-equals-default

    use '= default' to define a trivial destructor (https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html)

    (Note: You can add `Skip-Clang-Tidy-Checks: modernize-use-equals-default` footer to the CL description to skip the check)

    (Lint observed on `android-clang-tidy-rel`, but not on `linux-clang-tidy-rel`)

    Line 2109, Patchset 11 (Latest):SimpleURLLoader::~SimpleURLLoader() {}
    Takashi Toyoshima . unresolved

    Please fix this WARNING reported by ClangTidy: check: modernize-use-equals-default

    use '= default' to define a trivial destruc...

    check: modernize-use-equals-default

    use '= default' to define a trivial destructor (https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html)

    (Note: You can add `Skip-Clang-Tidy-Checks: modernize-use-equals-default` footer to the CL description to skip the check)

    (Lint observed on `linux-clang-tidy-rel`, but not on `android-clang-tidy-rel`)

    File services/network/public/mojom/network_context_client.mojom
    Line 22, Patchset 11 (Latest): // and renderer-initiated requests.
    Takashi Toyoshima . unresolved

    Can you add a TODO that says this will be non-nullable once the feature is fully enabled.

    File services/network/public/mojom/url_request.mojom
    Line 680, Patchset 11 (Latest): mojo_base.mojom.FilePath path;
    Takashi Toyoshima . unresolved

    also the same TODO here.

    File services/network/test/test_network_context_client.h
    Line 35, Patchset 11 (Latest): std::vector<mojom::FileUploadRequestPtr> files_to_upload,
    Takashi Toyoshima . unresolved

    why not const any more?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Nidhi Jaju
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Wed, 03 Jun 2026 02:56:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    Jun 3, 2026, 5:23:39 AM (8 days ago) Jun 3
    to Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 16 comments

    File chrome/browser/web_share_target/target_util.cc
    Line 59, Patchset 11: request_body->AppendFileRange(file_path, 0, -1, base::Time(), upload_token);
    Takashi Toyoshima . resolved

    `/*offset=*/0`

    Nidhi Jaju

    Done

    Line 59, Patchset 11: request_body->AppendFileRange(file_path, 0, -1, base::Time(), upload_token);
    Takashi Toyoshima . resolved

    `/*length=*/-1`

    Nidhi Jaju

    Done

    Line 59, Patchset 11: request_body->AppendFileRange(file_path, 0, -1, base::Time(), upload_token);
    Takashi Toyoshima . resolved

    `/*expected_modification_time=*/base=::Time()`

    Nidhi Jaju

    Done

    File content/browser/child_process_security_policy_impl.h
    Line 730, Patchset 11: base::TimeTicks creation_time;
    Takashi Toyoshima . resolved

    registration_time? `creation_time` for file_path is a bit confusing.

    Nidhi Jaju

    Done

    File content/browser/child_process_security_policy_impl.cc
    Line 923, Patchset 7: upload_tokens_[token] = {file_path, base::TimeTicks::Now()};
    Kenichi Ishibashi . resolved

    Can still grow unconditionally?

    Nidhi Jaju

    Entries in `upload_tokens_` have the same lifetime as the existing `file_permissions_`, they are tied to the `SecurityState` associated with the renderer process. This ensures that they last for the lifetime of the renderer process and are cleaned up when no longer needed.

    Takashi Toyoshima

    NavigationURLLoader case can be unregistered explicitly, but subresurce request cases are considerable here, but as we did the similar thing for file_path before, it would be ok.

    Nidhi Jaju

    Acknowledged

    Line 1045, Patchset 11: base::flat_map<base::UnguessableToken, UploadTokenInfo> upload_tokens_;
    Takashi Toyoshima . resolved

    just file_path is enough for the child process initiator cases?

    Nidhi Jaju

    Done

    Line 1868, Patchset 7: base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . unresolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    Nidhi Jaju
    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?

    Memory usage here should scale with the number of file uploads that are occurring, so doing more uploads will take more memory, but that has always been the case (there will be a number of other objects that scale with the number of uploads, and this isn't meaningfully adding to that bloat).

    • it's possible that the token might be lost if the upload takes a long time?

    If you request an upload, but then don't start actually performing that upload for 10 minutes, then it's technically possible for the permission to expire. However, I did an audit of all of the relevant codepaths and did not find any places where we'll significantly delay starting the upload. Even if the network is slow, it doesn't matter if the upload takes more than 10 minutes, the time that matters is how long after token creation you start the upload.

    Takashi Toyoshima

    Is it possible to unregister explicitly?
    Maybe called from the destructor, callback, or something like that of NavigationURLLoader and SimpleURLLoader?

    Nidhi Jaju

    This turned out to be non-trivial so I've uploaded a separate CL(https://crrev.com/c/7895739) for you to take a look at, please let me know what you think. If we think it's worth it, I'll rebase the rest of the CLs on top.

    File content/browser/network_context_client_base_impl.cc
    Line 48, Patchset 11: validation_success =
    Takashi Toyoshima . unresolved
    I think what you want here is
    ```
    !base::FeatureList::IsEnabled(...) && (
    process_id.is_browser() ||
    (!process_id.is_browser() && cpsp->CanReadFile())
    )
    ```
    As we always want the token in the new mode?
    Nidhi Jaju

    This would break renderer-initiated uploads when the feature is enabled. Note that I've added the token logic for renderer-initiated uploads in the next CL in the chain. For these cases, they will not have an `upload_token` and must continue to be validated via `CanReadFile()` when no token is present.

    File services/network/file_opener_for_upload.h
    Line 21, Patchset 11:#include "base/unguessable_token.h"
    Takashi Toyoshima . resolved

    wrong include place.

    Nidhi Jaju

    Done

    File services/network/file_opener_for_upload.cc
    Line 9, Patchset 11:#include "base/unguessable_token.h"
    Takashi Toyoshima . resolved

    dup, already included in the header side.

    Nidhi Jaju

    Done

    File services/network/public/cpp/simple_url_loader.h
    Line 197, Patchset 11: using UploadTokenRegisterCallback =

    base::RepeatingCallback<void(const base::UnguessableToken&,
    const base::FilePath&)>;
    Takashi Toyoshima . resolved
    Nidhi Jaju

    Done

    File services/network/public/cpp/simple_url_loader.cc
    Line 2109, Patchset 11:SimpleURLLoader::~SimpleURLLoader() {}
    Takashi Toyoshima . resolved

    Please fix this WARNING reported by ClangTidy: check: modernize-use-equals-default

    use '= default' to define a trivial destruc...

    check: modernize-use-equals-default

    use '= default' to define a trivial destructor (https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html)

    (Note: You can add `Skip-Clang-Tidy-Checks: modernize-use-equals-default` footer to the CL description to skip the check)

    (Lint observed on `linux-clang-tidy-rel`, but not on `android-clang-tidy-rel`)

    Nidhi Jaju

    Done

    Line 2109, Patchset 11:SimpleURLLoader::~SimpleURLLoader() {}
    Takashi Toyoshima . resolved

    Please fix this WARNING reported by ClangTidy: check: modernize-use-equals-default

    use '= default' to define a trivial destruc...

    check: modernize-use-equals-default

    use '= default' to define a trivial destructor (https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html)

    (Note: You can add `Skip-Clang-Tidy-Checks: modernize-use-equals-default` footer to the CL description to skip the check)

    (Lint observed on `android-clang-tidy-rel`, but not on `linux-clang-tidy-rel`)

    Nidhi Jaju

    Done

    File services/network/public/mojom/network_context_client.mojom
    Line 22, Patchset 11: // and renderer-initiated requests.
    Takashi Toyoshima . resolved

    Can you add a TODO that says this will be non-nullable once the feature is fully enabled.

    Nidhi Jaju

    Done

    File services/network/public/mojom/url_request.mojom
    Line 680, Patchset 11: mojo_base.mojom.FilePath path;
    Takashi Toyoshima . resolved

    also the same TODO here.

    Nidhi Jaju

    Done

    File services/network/test/test_network_context_client.h
    Line 35, Patchset 11: std::vector<mojom::FileUploadRequestPtr> files_to_upload,
    Takashi Toyoshima . unresolved

    why not const any more?

    Nidhi Jaju

    `mojom::FileUploadRequestPtr` is a Mojo struct pointer type which is move-only. This means that the C++ generated interface for Mojo methods passing arrays of move-only types uses `std::vector<mojom::FileUploadRequestPtr>` by value, allowing the elements to be moved. Passing it by `const &` is not supported by Mojo's generated C++ signature.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 12
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Wed, 03 Jun 2026 09:23:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kenichi Ishibashi (Gerrit)

    unread,
    Jun 3, 2026, 11:03:49 PM (7 days ago) Jun 3
    to Nidhi Jaju, Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Nidhi Jaju and Takashi Toyoshima

    Kenichi Ishibashi added 6 comments

    Patchset-level comments
    File-level comment, Patchset 12 (Latest):
    Kenichi Ishibashi . resolved

    My major concerns are mostly resolved. Thanks! I want to hear alexmos@'s thoughts on the overall approach.

    File content/browser/child_process_security_policy_impl.cc
    Line 1144, Patchset 12 (Latest): ChildProcessSecurityPolicyImpl::GetInstance()->RegisterUploadToken(
    Kenichi Ishibashi . unresolved

    Also curious about the life cycle of SimpleURLLoaders and ChildProcessSecurityPolicyImpl. Is it always guaranteed that the instance of CPSP outlives SimpleURLLoaders (especially shutdown/tear-down cases).

    Line 1868, Patchset 7: base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . unresolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    Nidhi Jaju
    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?

    Memory usage here should scale with the number of file uploads that are occurring, so doing more uploads will take more memory, but that has always been the case (there will be a number of other objects that scale with the number of uploads, and this isn't meaningfully adding to that bloat).

    • it's possible that the token might be lost if the upload takes a long time?

    If you request an upload, but then don't start actually performing that upload for 10 minutes, then it's technically possible for the permission to expire. However, I did an audit of all of the relevant codepaths and did not find any places where we'll significantly delay starting the upload. Even if the network is slow, it doesn't matter if the upload takes more than 10 minutes, the time that matters is how long after token creation you start the upload.

    Takashi Toyoshima

    Is it possible to unregister explicitly?
    Maybe called from the destructor, callback, or something like that of NavigationURLLoader and SimpleURLLoader?

    Nidhi Jaju

    This turned out to be non-trivial so I've uploaded a separate CL(https://crrev.com/c/7895739) for you to take a look at, please let me know what you think. If we think it's worth it, I'll rebase the rest of the CLs on top.

    Kenichi Ishibashi

    I want to hear toyoshim@'s opinion, but the separate CL looks a reasonable approach to me. If we go that direction, please add a TODO for the follow-up.

    File services/network/public/cpp/resource_request_body.h
    Line 67, Patchset 12 (Latest): const base::UnguessableToken& upload_token = base::UnguessableToken());
    Kenichi Ishibashi . unresolved

    Could you add method description to explain what's this?

    File services/network/public/cpp/resource_request_body_unittest.cc
    Line 48, Patchset 12 (Latest): ASSERT_EQ(orig_elements[0].type(), cloned_elements[0].type());
    EXPECT_EQ(orig_elements[0].As<DataElementBytes>().bytes(),
    cloned_elements[0].As<DataElementBytes>().bytes());

    ASSERT_EQ(orig_elements[1].type(), cloned_elements[1].type());
    const auto& orig_file = orig_elements[1].As<DataElementFile>();
    const auto& cloned_file = cloned_elements[1].As<DataElementFile>();
    EXPECT_EQ(orig_file.path(), cloned_file.path());
    EXPECT_EQ(orig_file.offset(), cloned_file.offset());
    EXPECT_EQ(orig_file.length(), cloned_file.length());
    EXPECT_EQ(orig_file.expected_modification_time(),
    cloned_file.expected_modification_time());
    EXPECT_EQ(orig_file.upload_token(), cloned_file.upload_token());
    Kenichi Ishibashi . unresolved

    These checks are useful, but these may not be robust enough to accommodate future field additions. May consider adding `operator==()` or `operator<=>()`?

    File services/network/public/cpp/simple_url_loader.h
    Line 313, Patchset 12 (Latest): // Sets callback for registering upload tokens.
    Kenichi Ishibashi . unresolved

    Could you make the comment a bit more detailed? For example, why is this necessary and how the callback will be used, who (embedder) sets this callback?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Nidhi Jaju
    • Takashi Toyoshima
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Thu, 04 Jun 2026 03:03:20 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    Jun 4, 2026, 4:25:09 AM (7 days ago) Jun 4
    to Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 4 comments

    File content/browser/child_process_security_policy_impl.cc
    Line 1144, Patchset 12: ChildProcessSecurityPolicyImpl::GetInstance()->RegisterUploadToken(
    Kenichi Ishibashi . unresolved

    Also curious about the life cycle of SimpleURLLoaders and ChildProcessSecurityPolicyImpl. Is it always guaranteed that the instance of CPSP outlives SimpleURLLoaders (especially shutdown/tear-down cases).

    Nidhi Jaju

    Yes, it is always guaranteed. `ChildProcessSecurityPolicyImpl` is a singleton (whose destructor is never called), so it lives for the entire duration of the browser process, including through the shutdown and tear-down phases. Because of this, it will safely outlive all instances of `SimpleURLLoader`.

    File services/network/public/cpp/resource_request_body.h
    Line 67, Patchset 12: const base::UnguessableToken& upload_token = base::UnguessableToken());
    Kenichi Ishibashi . resolved

    Could you add method description to explain what's this?

    Nidhi Jaju

    Done

    File services/network/public/cpp/resource_request_body_unittest.cc
    Line 48, Patchset 12: ASSERT_EQ(orig_elements[0].type(), cloned_elements[0].type());

    EXPECT_EQ(orig_elements[0].As<DataElementBytes>().bytes(),
    cloned_elements[0].As<DataElementBytes>().bytes());

    ASSERT_EQ(orig_elements[1].type(), cloned_elements[1].type());
    const auto& orig_file = orig_elements[1].As<DataElementFile>();
    const auto& cloned_file = cloned_elements[1].As<DataElementFile>();
    EXPECT_EQ(orig_file.path(), cloned_file.path());
    EXPECT_EQ(orig_file.offset(), cloned_file.offset());
    EXPECT_EQ(orig_file.length(), cloned_file.length());
    EXPECT_EQ(orig_file.expected_modification_time(),
    cloned_file.expected_modification_time());
    EXPECT_EQ(orig_file.upload_token(), cloned_file.upload_token());
    Kenichi Ishibashi . resolved

    These checks are useful, but these may not be robust enough to accommodate future field additions. May consider adding `operator==()` or `operator<=>()`?

    Nidhi Jaju

    Done

    File services/network/public/cpp/simple_url_loader.h
    Line 313, Patchset 12: // Sets callback for registering upload tokens.
    Kenichi Ishibashi . resolved

    Could you make the comment a bit more detailed? For example, why is this necessary and how the callback will be used, who (embedder) sets this callback?

    Nidhi Jaju

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 13
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Thu, 04 Jun 2026 08:24:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kenichi Ishibashi <ba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Adam Rice (Gerrit)

    unread,
    Jun 4, 2026, 7:23:02 AM (7 days ago) Jun 4
    to Nidhi Jaju, Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi, Nidhi Jaju and Takashi Toyoshima

    Adam Rice added 2 comments

    Patchset-level comments
    File-level comment, Patchset 8:
    Adam Rice . resolved

    Random drive-by. I haven't properly reviewed anything.

    File content/browser/child_process_security_policy_impl.h
    Line 1252, Patchset 8: base::flat_map<base::UnguessableToken, UploadTokenInfo> browser_upload_tokens_
    Adam Rice . unresolved

    IIUC, this could have thousands of entries. I think `flat_map` is a bad choice for this, because insertion takes O(N) time. `absl::flat_hash_map` might be better.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Nidhi Jaju
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 8
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Adam Rice <ri...@google.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Thu, 04 Jun 2026 11:22:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alex Moshchuk (Gerrit)

    unread,
    Jun 4, 2026, 9:21:18 PM (6 days ago) Jun 4
    to Nidhi Jaju, Adam Rice, Takashi Toyoshima, Hiroshige Hayashizaki, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Hiroshige Hayashizaki, Kenichi Ishibashi, Nidhi Jaju and Takashi Toyoshima

    Alex Moshchuk added 3 comments

    Patchset-level comments
    File-level comment, Patchset 13 (Latest):
    Alex Moshchuk . unresolved

    Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

    Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

    File content/browser/child_process_security_policy_impl.h
    Line 1129, Patchset 13 (Latest): mutable base::Lock lock_;
    Alex Moshchuk . unresolved

    We probably should avoid this for now (as well as avoid marking the function that needed it as const). For the purposes of our Rust conversion, it will make it more difficult to reason about CPSP functions claiming to be const but still actually being able to mutate some of its members (e.g. when called from Rust). Also, the precedent in the rest of the file so far has been not to do this in similar functions, so even if we wanted to do it, it's better to split it into a separate CL.

    File content/browser/child_process_security_policy_impl.cc
    Line 1137, Patchset 11: // Set the callback for SimpleURLLoader to automatically register unguessable

    // upload tokens for browser-initiated requests. The
    // ChildProcessSecurityPolicyImpl constructor runs exactly once very early on
    // the UI thread during startup, ensuring thread-safe registration before any
    // network requests can be processed.
    network::SimpleURLLoader::SetUploadTokenRegisterCallback(base::BindRepeating(
    [](const base::UnguessableToken& token, const base::FilePath& path) {
    ChildProcessSecurityPolicyImpl::GetInstance()->RegisterUploadToken(
    ChildProcessId(), token, path);
    }));
    Takashi Toyoshima . unresolved

    Well... technically said, this correctly handles the required layering dependency. But as the Rust version of this component is under experiments, this dependency might matter, and it might be better to have this callback registration outside this constructor, besides the ctor's call site.
    creis@ is the best to ask?

    Alex Moshchuk

    Thanks for asking!

    Currently, this will get initialized when there's a very first check involving ChildProcessSecurityPolicy, and this is currently different on different platforms and can change over time. We've already seen a bug because of this: https://crbug.com/507737405, where it happened before the Finch flags were even initialized. I wonder if this might be problematic if the network service code gets invoked too early, though it looks like this particular call just does dependency injection and saves a callback, and doesn't actually need to send an IPC to the network service process. Is that right?

    Overall, though, because of this non-determinism we feel that it might be better to move this registration to a more well-defined place somewhere on the browser startup path in content/. Maybe something like [this](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/browser_main_loop.cc;l=828-836;drc=46b1094602f60b37f23a55d04d9d2fefcd1c0a14), where we also initialize other site isolation properties that need to be in place before any navigation can happen?

    This will also make it easier to reason about the Rust conversion, as there will be less of a risk of forgetting to do an equivalent registration in the Rust CPSP initialization code. And we can also consider similarly moving the `RegisterDefaultSchemes()` call outside of the CPSP constructor in a followup.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Nidhi Jaju
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 13
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Adam Rice <ri...@google.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Jun 2026 01:21:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Toyoshima (Gerrit)

    unread,
    Jun 4, 2026, 9:30:21 PM (6 days ago) Jun 4
    to Nidhi Jaju, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Hiroshige Hayashizaki, Kenichi Ishibashi and Nidhi Jaju

    Takashi Toyoshima added 3 comments

    File content/browser/child_process_security_policy_impl.cc
    Line 1868, Patchset 7: base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . unresolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    Nidhi Jaju
    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?

    Memory usage here should scale with the number of file uploads that are occurring, so doing more uploads will take more memory, but that has always been the case (there will be a number of other objects that scale with the number of uploads, and this isn't meaningfully adding to that bloat).

    • it's possible that the token might be lost if the upload takes a long time?

    If you request an upload, but then don't start actually performing that upload for 10 minutes, then it's technically possible for the permission to expire. However, I did an audit of all of the relevant codepaths and did not find any places where we'll significantly delay starting the upload. Even if the network is slow, it doesn't matter if the upload takes more than 10 minutes, the time that matters is how long after token creation you start the upload.

    Takashi Toyoshima

    Is it possible to unregister explicitly?
    Maybe called from the destructor, callback, or something like that of NavigationURLLoader and SimpleURLLoader?

    Nidhi Jaju

    This turned out to be non-trivial so I've uploaded a separate CL(https://crrev.com/c/7895739) for you to take a look at, please let me know what you think. If we think it's worth it, I'll rebase the rest of the CLs on top.

    Kenichi Ishibashi

    I want to hear toyoshim@'s opinion, but the separate CL looks a reasonable approach to me. If we go that direction, please add a TODO for the follow-up.

    Takashi Toyoshima

    Yep. It looks reasonable to me too.

    File content/browser/network_context_client_base_impl.cc
    Line 48, Patchset 11: validation_success =
    Takashi Toyoshima . unresolved
    I think what you want here is
    ```
    !base::FeatureList::IsEnabled(...) && (
    process_id.is_browser() ||
    (!process_id.is_browser() && cpsp->CanReadFile())
    )
    ```
    As we always want the token in the new mode?
    Nidhi Jaju

    This would break renderer-initiated uploads when the feature is enabled. Note that I've added the token logic for renderer-initiated uploads in the next CL in the chain. For these cases, they will not have an `upload_token` and must continue to be validated via `CanReadFile()` when no token is present.

    Takashi Toyoshima
    Ah, I see. So, we would want a TODO.
    Also, it might be better to have clearly separated logics for each mode even if it is redundant. It helps to avoid mistakes.
    I meant something like this;
    ```
    if (!base::FeatureList::IsEnabled(...)) {
    ...
    } else ]
    // TODO...
    ...
    }
    ```
    File services/network/test/test_network_context_client.h
    Line 35, Patchset 11: std::vector<mojom::FileUploadRequestPtr> files_to_upload,
    Takashi Toyoshima . resolved

    why not const any more?

    Nidhi Jaju

    `mojom::FileUploadRequestPtr` is a Mojo struct pointer type which is move-only. This means that the C++ generated interface for Mojo methods passing arrays of move-only types uses `std::vector<mojom::FileUploadRequestPtr>` by value, allowing the elements to be moved. Passing it by `const &` is not supported by Mojo's generated C++ signature.

    Takashi Toyoshima

    Acknowledged

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Nidhi Jaju
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Jun 2026 01:29:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nidhi Jaju (Gerrit)

    unread,
    Jun 5, 2026, 5:23:55 AM (6 days ago) Jun 5
    to Adam Rice, Takashi Toyoshima, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Takashi Toyoshima

    Nidhi Jaju added 7 comments

    Patchset-level comments
    Alex Moshchuk . unresolved

    Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

    Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

    Nidhi Jaju

    Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

    File content/browser/child_process_security_policy_impl.h
    Line 1129, Patchset 13: mutable base::Lock lock_;
    Alex Moshchuk . resolved

    We probably should avoid this for now (as well as avoid marking the function that needed it as const). For the purposes of our Rust conversion, it will make it more difficult to reason about CPSP functions claiming to be const but still actually being able to mutate some of its members (e.g. when called from Rust). Also, the precedent in the rest of the file so far has been not to do this in similar functions, so even if we wanted to do it, it's better to split it into a separate CL.

    Nidhi Jaju

    Done

    Line 1252, Patchset 8: base::flat_map<base::UnguessableToken, UploadTokenInfo> browser_upload_tokens_
    Adam Rice . resolved

    IIUC, this could have thousands of entries. I think `flat_map` is a bad choice for this, because insertion takes O(N) time. `absl::flat_hash_map` might be better.

    Nidhi Jaju

    Good point, I've updated both `browser_upload_tokens_` and `upload_tokens_` to be `absl::flat_hash_map`s.

    File content/browser/child_process_security_policy_impl.cc
    Line 1144, Patchset 12: ChildProcessSecurityPolicyImpl::GetInstance()->RegisterUploadToken(
    Kenichi Ishibashi . resolved

    Also curious about the life cycle of SimpleURLLoaders and ChildProcessSecurityPolicyImpl. Is it always guaranteed that the instance of CPSP outlives SimpleURLLoaders (especially shutdown/tear-down cases).

    Nidhi Jaju

    Yes, it is always guaranteed. `ChildProcessSecurityPolicyImpl` is a singleton (whose destructor is never called), so it lives for the entire duration of the browser process, including through the shutdown and tear-down phases. Because of this, it will safely outlive all instances of `SimpleURLLoader`.

    Nidhi Jaju

    Resolving since I moved it to BrowserMainLoop based on Alex's most recent feedback.

    Line 1137, Patchset 11: // Set the callback for SimpleURLLoader to automatically register unguessable
    // upload tokens for browser-initiated requests. The
    // ChildProcessSecurityPolicyImpl constructor runs exactly once very early on
    // the UI thread during startup, ensuring thread-safe registration before any
    // network requests can be processed.
    network::SimpleURLLoader::SetUploadTokenRegisterCallback(base::BindRepeating(
    [](const base::UnguessableToken& token, const base::FilePath& path) {
    ChildProcessSecurityPolicyImpl::GetInstance()->RegisterUploadToken(
    ChildProcessId(), token, path);
    }));
    Takashi Toyoshima . resolved

    Well... technically said, this correctly handles the required layering dependency. But as the Rust version of this component is under experiments, this dependency might matter, and it might be better to have this callback registration outside this constructor, besides the ctor's call site.
    creis@ is the best to ask?

    Alex Moshchuk

    Thanks for asking!

    Currently, this will get initialized when there's a very first check involving ChildProcessSecurityPolicy, and this is currently different on different platforms and can change over time. We've already seen a bug because of this: https://crbug.com/507737405, where it happened before the Finch flags were even initialized. I wonder if this might be problematic if the network service code gets invoked too early, though it looks like this particular call just does dependency injection and saves a callback, and doesn't actually need to send an IPC to the network service process. Is that right?

    Overall, though, because of this non-determinism we feel that it might be better to move this registration to a more well-defined place somewhere on the browser startup path in content/. Maybe something like [this](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/browser_main_loop.cc;l=828-836;drc=46b1094602f60b37f23a55d04d9d2fefcd1c0a14), where we also initialize other site isolation properties that need to be in place before any navigation can happen?

    This will also make it easier to reason about the Rust conversion, as there will be less of a risk of forgetting to do an equivalent registration in the Rust CPSP initialization code. And we can also consider similarly moving the `RegisterDefaultSchemes()` call outside of the CPSP constructor in a followup.

    Nidhi Jaju

    Thank you! Yes I was considering putting it in the `BrowserMainLoop::CreateStartupTasks()`, but wasn't sure it was a good idea (e.g. if it would block other critical startup tasks). Moved to `BrowserMainLoop::PreCreateThreads()` as you suggested.

    Line 1868, Patchset 7: base::TimeDelta timeout = base::Minutes(10);
    Kenichi Ishibashi . resolved

    So does this mean:

    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?
    • it's possible that the token might be lost if the upload takes a long time?

    (I'm not very familiar with file uploads so I might be saying something strange)

    Nidhi Jaju
    • there's still a possibility of memory bloat when processing a large number of requests in a short period of time?

    Memory usage here should scale with the number of file uploads that are occurring, so doing more uploads will take more memory, but that has always been the case (there will be a number of other objects that scale with the number of uploads, and this isn't meaningfully adding to that bloat).

    • it's possible that the token might be lost if the upload takes a long time?

    If you request an upload, but then don't start actually performing that upload for 10 minutes, then it's technically possible for the permission to expire. However, I did an audit of all of the relevant codepaths and did not find any places where we'll significantly delay starting the upload. Even if the network is slow, it doesn't matter if the upload takes more than 10 minutes, the time that matters is how long after token creation you start the upload.

    Takashi Toyoshima

    Is it possible to unregister explicitly?
    Maybe called from the destructor, callback, or something like that of NavigationURLLoader and SimpleURLLoader?

    Nidhi Jaju

    This turned out to be non-trivial so I've uploaded a separate CL(https://crrev.com/c/7895739) for you to take a look at, please let me know what you think. If we think it's worth it, I'll rebase the rest of the CLs on top.

    Kenichi Ishibashi

    I want to hear toyoshim@'s opinion, but the separate CL looks a reasonable approach to me. If we go that direction, please add a TODO for the follow-up.

    Takashi Toyoshima

    Yep. It looks reasonable to me too.

    Nidhi Jaju

    Done

    File content/browser/network_context_client_base_impl.cc
    Line 48, Patchset 11: validation_success =
    Takashi Toyoshima . resolved
    I think what you want here is
    ```
    !base::FeatureList::IsEnabled(...) && (
    process_id.is_browser() ||
    (!process_id.is_browser() && cpsp->CanReadFile())
    )
    ```
    As we always want the token in the new mode?
    Nidhi Jaju

    This would break renderer-initiated uploads when the feature is enabled. Note that I've added the token logic for renderer-initiated uploads in the next CL in the chain. For these cases, they will not have an `upload_token` and must continue to be validated via `CanReadFile()` when no token is present.

    Takashi Toyoshima
    Ah, I see. So, we would want a TODO.
    Also, it might be better to have clearly separated logics for each mode even if it is redundant. It helps to avoid mistakes.
    I meant something like this;
    ```
    if (!base::FeatureList::IsEnabled(...)) {
    ...
    } else ]
    // TODO...
    ...
    }
    ```
    Nidhi Jaju

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Adam Rice
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Takashi Toyoshima
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
    Gerrit-Change-Number: 7878365
    Gerrit-PatchSet: 14
    Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Adam Rice <ri...@google.com>
    Gerrit-CC: James Maclean <wjma...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
    Gerrit-Attention: Adam Rice <ri...@google.com>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
    Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Jun 2026 09:23:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Alex Moshchuk <ale...@chromium.org>
    Comment-In-Reply-To: Adam Rice <ri...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Toyoshima (Gerrit)

    unread,
    Jun 8, 2026, 1:02:40 AM (3 days ago) Jun 8
    to Nidhi Jaju, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Nidhi Jaju

    Takashi Toyoshima voted and added 2 comments

    Votes added by Takashi Toyoshima

    Code-Review+1

    2 comments

    File content/browser/child_process_security_policy_impl.cc
    Line 1869, Patchset 14 (Latest): if (child_id.is_null()) {
    Takashi Toyoshima . unresolved

    Can you have an explicit TODO with a link to the follow-up CL?

    File content/browser/network_context_client_base_impl_unittest.cc
    Line 66, Patchset 14 (Latest): DCHECK_EQ(paths.size(), tokens.size());
    Takashi Toyoshima . unresolved

    Prefer EXPECT_EQ over DCHECK_EQ in tests

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Adam Rice
    • Alex Moshchuk
    • Hiroshige Hayashizaki
    • Kenichi Ishibashi
    • Nidhi Jaju
    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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
      Gerrit-Change-Number: 7878365
      Gerrit-PatchSet: 14
      Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Adam Rice <ri...@google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Mon, 08 Jun 2026 05:02:11 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Nidhi Jaju (Gerrit)

      unread,
      Jun 8, 2026, 5:29:30 AM (3 days ago) Jun 8
      to Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki and Kenichi Ishibashi

      Nidhi Jaju added 1 comment

      Patchset-level comments
      Alex Moshchuk . unresolved

      Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

      Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

      Nidhi Jaju

      Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Hiroshige Hayashizaki
      • Kenichi Ishibashi
      Gerrit-Comment-Date: Mon, 08 Jun 2026 09:29:02 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Alex Moshchuk <ale...@chromium.org>
      Comment-In-Reply-To: Nidhi Jaju <nidh...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Nidhi Jaju (Gerrit)

      unread,
      Jun 8, 2026, 5:46:24 AM (3 days ago) Jun 8
      to Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki and Kenichi Ishibashi

      Nidhi Jaju added 2 comments

      File content/browser/child_process_security_policy_impl.cc
      Line 1869, Patchset 14: if (child_id.is_null()) {
      Takashi Toyoshima . resolved

      Can you have an explicit TODO with a link to the follow-up CL?

      Nidhi Jaju

      Done

      File content/browser/network_context_client_base_impl_unittest.cc
      Line 66, Patchset 14: DCHECK_EQ(paths.size(), tokens.size());
      Takashi Toyoshima . resolved

      Prefer EXPECT_EQ over DCHECK_EQ in tests

      Nidhi Jaju

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Hiroshige Hayashizaki
      • 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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
      Gerrit-Change-Number: 7878365
      Gerrit-PatchSet: 15
      Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Adam Rice <ri...@google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Comment-Date: Mon, 08 Jun 2026 09:45:55 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Nidhi Jaju (Gerrit)

      unread,
      Jun 8, 2026, 5:46:55 AM (3 days ago) Jun 8
      to Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk, Glenn Hartmann, Hiroshige Hayashizaki and Kenichi Ishibashi

      Nidhi Jaju added 1 comment

      Patchset-level comments
      File-level comment, Patchset 15 (Latest):
      Nidhi Jaju . resolved

      Hi Glenn, could you take a look at the web_share_target/ files? Thank you!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Glenn Hartmann
      • Hiroshige Hayashizaki
      • 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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
      Gerrit-Change-Number: 7878365
      Gerrit-PatchSet: 15
      Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Glenn Hartmann <hart...@chromium.org>
      Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Adam Rice <ri...@google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Attention: Glenn Hartmann <hart...@chromium.org>
      Gerrit-Comment-Date: Mon, 08 Jun 2026 09:46:31 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Glenn Hartmann (Gerrit)

      unread,
      Jun 8, 2026, 1:47:56 PM (3 days ago) Jun 8
      to Nidhi Jaju, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Kenichi Ishibashi, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki, Kenichi Ishibashi and Nidhi Jaju

      Glenn Hartmann voted and added 1 comment

      Votes added by Glenn Hartmann

      Code-Review+1

      1 comment

      Patchset-level comments
      Glenn Hartmann . resolved

      web_share_target/ lgtm

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Hiroshige Hayashizaki
      • Kenichi Ishibashi
      • Nidhi Jaju
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Mon, 08 Jun 2026 17:47:42 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Kenichi Ishibashi (Gerrit)

      unread,
      Jun 8, 2026, 8:50:40 PM (2 days ago) Jun 8
      to Nidhi Jaju, Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki and Nidhi Jaju

      Kenichi Ishibashi voted and added 3 comments

      Votes added by Kenichi Ishibashi

      Code-Review+1

      3 comments

      Patchset-level comments
      Kenichi Ishibashi . resolved

      //services/network lgtm.

      File services/network/file_opener_for_upload.h
      Line 27, Patchset 15 (Latest):struct FileUploadInfo {
      Kenichi Ishibashi . unresolved

      nit: Please add struct comment for FileUploadInfo.

      File services/network/public/cpp/resource_request_body.cc
      Line 32, Patchset 15 (Latest): if (!(elements_[i] == other.elements_[i])) {
      Kenichi Ishibashi . unresolved

      nit: Simply `elements_[i] != other.elements_[i]`?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Hiroshige Hayashizaki
      • Nidhi Jaju
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Jun 2026 00:49:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Nidhi Jaju (Gerrit)

      unread,
      Jun 9, 2026, 3:38:37 AM (2 days ago) Jun 9
      to Kenichi Ishibashi, Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk and Hiroshige Hayashizaki

      Nidhi Jaju added 2 comments

      File services/network/file_opener_for_upload.h
      Line 27, Patchset 15:struct FileUploadInfo {
      Kenichi Ishibashi . resolved

      nit: Please add struct comment for FileUploadInfo.

      Nidhi Jaju

      Done

      File services/network/public/cpp/resource_request_body.cc
      Line 32, Patchset 15: if (!(elements_[i] == other.elements_[i])) {
      Kenichi Ishibashi . resolved

      nit: Simply `elements_[i] != other.elements_[i]`?

      Nidhi Jaju

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Hiroshige Hayashizaki
      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: Iaa9d1ade16b6c942c1e5202bc5c750c7cd88cf60
      Gerrit-Change-Number: 7878365
      Gerrit-PatchSet: 16
      Gerrit-Owner: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Glenn Hartmann <hart...@chromium.org>
      Gerrit-Reviewer: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Reviewer: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Adam Rice <ri...@google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Jun 2026 07:38:12 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Kenichi Ishibashi <ba...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Moshchuk (Gerrit)

      unread,
      Jun 9, 2026, 6:56:34 PM (2 days ago) Jun 9
      to Nidhi Jaju, Kenichi Ishibashi, Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Hiroshige Hayashizaki and Nidhi Jaju

      Alex Moshchuk added 1 comment

      Patchset-level comments
      Alex Moshchuk . unresolved

      Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

      Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

      Nidhi Jaju

      Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

      Nidhi Jaju

      Here's the design doc: https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?usp=sharing&resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ

      Alex Moshchuk

      Thanks for writing the doc!

      creis@, lbrady@, and I discussed it in our CSA sync today, and we have a high-level concern that this approach might be overly complicated. I've asked some clarifying questions on the doc, but the high-level points are:

      • It's not clear why the solution focuses on both browser- and renderer-initiated file upload paths, since the bug seems to be purely about the browser-initiated cases, and we already have CPSP::CanReadFile validation for the renderer-initiated cases. What benefits do we get out of the additional validation for renderer-initiated file upload cases (which add a lot of complexity)? Note that a compromised network service already effectively has access to all files requested by any renderer (since those file upload requests go through the NS), and using tokens doesn't change that as the NS process can choose whatever token+path it wants to pass to the browser process.
      • Even for the browser-initiated case, it's not clear what additional security value we're getting from tracking files with UnguessableTokens instead of a simple set of FilePaths. Could this be solved simply by tracking FilePaths for browser-initiated file uploads in CPSP, to complement the existing per-renderer FilePaths in SecurityState? Or maybe option 1 becomes simpler to implement without all the renderer-side changes, and then we don't need to modify CPSP at all, and just pass a PendingRemote for opening a file from browser-initiated upload entrypoints (which might also simplify reasoning about lifetimes in that case).
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Hiroshige Hayashizaki
      • Nidhi Jaju
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Jun 2026 22:56:18 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      Jun 10, 2026, 4:13:35 AM (yesterday) Jun 10
      to Nidhi Jaju, Kenichi Ishibashi, Glenn Hartmann, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Hiroshige Hayashizaki and Nidhi Jaju

      Takashi Toyoshima voted and added 1 comment

      Votes added by Takashi Toyoshima

      Code-Review+1

      1 comment

      Patchset-level comments
      Alex Moshchuk . unresolved

      Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

      Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

      Nidhi Jaju

      Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

      Nidhi Jaju

      Here's the design doc: https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?usp=sharing&resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ

      Alex Moshchuk

      Thanks for writing the doc!

      creis@, lbrady@, and I discussed it in our CSA sync today, and we have a high-level concern that this approach might be overly complicated. I've asked some clarifying questions on the doc, but the high-level points are:

      • It's not clear why the solution focuses on both browser- and renderer-initiated file upload paths, since the bug seems to be purely about the browser-initiated cases, and we already have CPSP::CanReadFile validation for the renderer-initiated cases. What benefits do we get out of the additional validation for renderer-initiated file upload cases (which add a lot of complexity)? Note that a compromised network service already effectively has access to all files requested by any renderer (since those file upload requests go through the NS), and using tokens doesn't change that as the NS process can choose whatever token+path it wants to pass to the browser process.
      • Even for the browser-initiated case, it's not clear what additional security value we're getting from tracking files with UnguessableTokens instead of a simple set of FilePaths. Could this be solved simply by tracking FilePaths for browser-initiated file uploads in CPSP, to complement the existing per-renderer FilePaths in SecurityState? Or maybe option 1 becomes simpler to implement without all the renderer-side changes, and then we don't need to modify CPSP at all, and just pass a PendingRemote for opening a file from browser-initiated upload entrypoints (which might also simplify reasoning about lifetimes in that case).
      Takashi Toyoshima

      Thank you for the discussion. Both proposals sound much simpler than current approach.

      Nidhi,
      What do you think? I'm fine with both of Alex's proposed approaches,

      Gerrit-Comment-Date: Wed, 10 Jun 2026 08:13:08 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Nidhi Jaju (Gerrit)

      unread,
      Jun 10, 2026, 4:19:05 AM (yesterday) Jun 10
      to Kenichi Ishibashi, Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Alex Moshchuk, Hiroshige Hayashizaki and Takashi Toyoshima

      Nidhi Jaju added 1 comment

      Patchset-level comments
      Alex Moshchuk . unresolved

      Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

      Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

      Nidhi Jaju

      Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

      Nidhi Jaju

      Here's the design doc: https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?usp=sharing&resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ

      Alex Moshchuk

      Thanks for writing the doc!

      creis@, lbrady@, and I discussed it in our CSA sync today, and we have a high-level concern that this approach might be overly complicated. I've asked some clarifying questions on the doc, but the high-level points are:

      • It's not clear why the solution focuses on both browser- and renderer-initiated file upload paths, since the bug seems to be purely about the browser-initiated cases, and we already have CPSP::CanReadFile validation for the renderer-initiated cases. What benefits do we get out of the additional validation for renderer-initiated file upload cases (which add a lot of complexity)? Note that a compromised network service already effectively has access to all files requested by any renderer (since those file upload requests go through the NS), and using tokens doesn't change that as the NS process can choose whatever token+path it wants to pass to the browser process.
      • Even for the browser-initiated case, it's not clear what additional security value we're getting from tracking files with UnguessableTokens instead of a simple set of FilePaths. Could this be solved simply by tracking FilePaths for browser-initiated file uploads in CPSP, to complement the existing per-renderer FilePaths in SecurityState? Or maybe option 1 becomes simpler to implement without all the renderer-side changes, and then we don't need to modify CPSP at all, and just pass a PendingRemote for opening a file from browser-initiated upload entrypoints (which might also simplify reasoning about lifetimes in that case).
      Takashi Toyoshima

      Thank you for the discussion. Both proposals sound much simpler than current approach.

      Nidhi,
      What do you think? I'm fine with both of Alex's proposed approaches,

      Nidhi Jaju

      Thanks for reviewing the document and discussing it further! I've responded to the comments on the document with additional details, so will keep discussion there, but if we're okay with the less strict enforcement, then I'm happy to avoid some of the complexity wherever possible by using an alternate approach.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Moshchuk
      • Hiroshige Hayashizaki
      • Takashi Toyoshima
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 08:18:40 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Alex Moshchuk <ale...@chromium.org>
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      Comment-In-Reply-To: Nidhi Jaju <nidh...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Moshchuk (Gerrit)

      unread,
      Jun 10, 2026, 6:42:19 PM (12 hours ago) Jun 10
      to Nidhi Jaju, Kenichi Ishibashi, Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Hiroshige Hayashizaki, Nidhi Jaju and Takashi Toyoshima

      Alex Moshchuk added 1 comment

      Patchset-level comments
      Alex Moshchuk . unresolved

      Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

      Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

      Nidhi Jaju

      Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

      Nidhi Jaju

      Here's the design doc: https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?usp=sharing&resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ

      Alex Moshchuk

      Thanks for writing the doc!

      creis@, lbrady@, and I discussed it in our CSA sync today, and we have a high-level concern that this approach might be overly complicated. I've asked some clarifying questions on the doc, but the high-level points are:

      • It's not clear why the solution focuses on both browser- and renderer-initiated file upload paths, since the bug seems to be purely about the browser-initiated cases, and we already have CPSP::CanReadFile validation for the renderer-initiated cases. What benefits do we get out of the additional validation for renderer-initiated file upload cases (which add a lot of complexity)? Note that a compromised network service already effectively has access to all files requested by any renderer (since those file upload requests go through the NS), and using tokens doesn't change that as the NS process can choose whatever token+path it wants to pass to the browser process.
      • Even for the browser-initiated case, it's not clear what additional security value we're getting from tracking files with UnguessableTokens instead of a simple set of FilePaths. Could this be solved simply by tracking FilePaths for browser-initiated file uploads in CPSP, to complement the existing per-renderer FilePaths in SecurityState? Or maybe option 1 becomes simpler to implement without all the renderer-side changes, and then we don't need to modify CPSP at all, and just pass a PendingRemote for opening a file from browser-initiated upload entrypoints (which might also simplify reasoning about lifetimes in that case).
      Takashi Toyoshima

      Thank you for the discussion. Both proposals sound much simpler than current approach.

      Nidhi,
      What do you think? I'm fine with both of Alex's proposed approaches,

      Nidhi Jaju

      Thanks for reviewing the document and discussing it further! I've responded to the comments on the document with additional details, so will keep discussion there, but if we're okay with the less strict enforcement, then I'm happy to avoid some of the complexity wherever possible by using an alternate approach.

      Alex Moshchuk

      Thanks, responded on the doc. I do still think that it's worth simplifying this to one of those two options ((1) passing something like a `mojo::PendingRemote<FileOpener>` to the network service for files to be uploaded, which can be used to open a particular file, or (2) tracking FilePaths for browser-initiated uploads in CPSP).

      I'm realizing based on comments on the doc that (1) would kind of align with what we already do for downloading files, and it also avoids storing a second copy of all the FilePaths for form submissions (per [this discussion](https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ&disco=AAAB9DYsNe0)). But if (2) is simpler to do, it would work just as well.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Hiroshige Hayashizaki
      • Nidhi Jaju
      • Takashi Toyoshima
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 22:42:00 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      1:39 AM (5 hours ago) 1:39 AM
      to Nidhi Jaju, Kenichi Ishibashi, Glenn Hartmann, Takashi Toyoshima, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Hiroshige Hayashizaki, Nidhi Jaju and Takashi Toyoshima

      Adam Rice added 1 comment

      Patchset-level comments
      Alex Moshchuk . unresolved

      Thanks for including me in the reviewers list (and thanks to toyoshim@ for mentioning it offline)! creis@, lbrady@ and I discussed this CL today - overall we feel this problem is definitely important to fix, and on a high-level the approach of validating file paths with tokens to protect against a compromised NS process should work. However, this is a very large CL with many moving parts (with more left to future CLs), and we feel it's worth having a more formal design doc for this where we could read about and discuss some of the aspects of this solution. For example, how the handling for renderer-initiated vs browser-initiated file uploads differs, why we need the timeouts in the browser-initiated case, how session restore gets handled, where the tokens should be generated (outside vs inside CPSP), how multiple network requests for the same file would get handled, etc. Would it be possible to write such a doc?

      Also, it's worth mentioning that CSA has plans for a project to introduce a stronger type to represent files actually chosen by the user (UserChosenFilePath); the browser process and network service could then limit file uploads to instances of that type instead of any constructed FilePath, making it impossible for compromised renderers to invent a new path to upload without going through the validation that UserChosenFilePath would require. It's worth thinking about how that would align with this CL; it seems like the validation tokens proposed here would be complementary and could actually be stored within a UserChosenFilePath. More information here: https://docs.google.com/document/d/11n60HcDDLhgWOxicR0OTk0CXy0L2TgUYX7eRJdcp5G0/edit?tab=t.0#bookmark=id.gj7o4ss8b2l4.

      Nidhi Jaju

      Thank you for the detailed context! I'm working on a doc that I'll share with you early next week.

      Nidhi Jaju

      Here's the design doc: https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?usp=sharing&resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ

      Alex Moshchuk

      Thanks for writing the doc!

      creis@, lbrady@, and I discussed it in our CSA sync today, and we have a high-level concern that this approach might be overly complicated. I've asked some clarifying questions on the doc, but the high-level points are:

      • It's not clear why the solution focuses on both browser- and renderer-initiated file upload paths, since the bug seems to be purely about the browser-initiated cases, and we already have CPSP::CanReadFile validation for the renderer-initiated cases. What benefits do we get out of the additional validation for renderer-initiated file upload cases (which add a lot of complexity)? Note that a compromised network service already effectively has access to all files requested by any renderer (since those file upload requests go through the NS), and using tokens doesn't change that as the NS process can choose whatever token+path it wants to pass to the browser process.
      • Even for the browser-initiated case, it's not clear what additional security value we're getting from tracking files with UnguessableTokens instead of a simple set of FilePaths. Could this be solved simply by tracking FilePaths for browser-initiated file uploads in CPSP, to complement the existing per-renderer FilePaths in SecurityState? Or maybe option 1 becomes simpler to implement without all the renderer-side changes, and then we don't need to modify CPSP at all, and just pass a PendingRemote for opening a file from browser-initiated upload entrypoints (which might also simplify reasoning about lifetimes in that case).
      Takashi Toyoshima

      Thank you for the discussion. Both proposals sound much simpler than current approach.

      Nidhi,
      What do you think? I'm fine with both of Alex's proposed approaches,

      Nidhi Jaju

      Thanks for reviewing the document and discussing it further! I've responded to the comments on the document with additional details, so will keep discussion there, but if we're okay with the less strict enforcement, then I'm happy to avoid some of the complexity wherever possible by using an alternate approach.

      Alex Moshchuk

      Thanks, responded on the doc. I do still think that it's worth simplifying this to one of those two options ((1) passing something like a `mojo::PendingRemote<FileOpener>` to the network service for files to be uploaded, which can be used to open a particular file, or (2) tracking FilePaths for browser-initiated uploads in CPSP).

      I'm realizing based on comments on the doc that (1) would kind of align with what we already do for downloading files, and it also avoids storing a second copy of all the FilePaths for form submissions (per [this discussion](https://docs.google.com/document/d/1PnU2PGfuXcYEV8lC1ElCw_tiRPu2yl4zDDNukBlV_Bo/edit?resourcekey=0-tVjMQ_o3i0A60j8D8NVlrQ&disco=AAAB9DYsNe0)). But if (2) is simpler to do, it would work just as well.

      Adam Rice

      I have a preference for UnguessableTokens over PendingRemotes because UnguessableTokens are copyable. Unfortunately we need to copy network::ResourceRequests in a few places, and any time we copy a PendingRemote we have to send a Clone() IPC which adds complexity and overhead.

      Gerrit-CC: Adam Rice <ri...@chromium.org>
      Gerrit-CC: Adam Rice <ri...@google.com>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@google.com>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Thu, 11 Jun 2026 05:38:53 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      5:31 AM (2 hours ago) 5:31 AM
      to Nidhi Jaju, Adam Rice, Kenichi Ishibashi, Glenn Hartmann, Adam Rice, Hiroshige Hayashizaki, Alex Moshchuk, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, prerendering-reviews, James Maclean, andysjl...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, gavin...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, nwoked...@chromium.org, tburkar...@chromium.org, vakh+safe_br...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
      Attention needed from Adam Rice, Hiroshige Hayashizaki and Nidhi Jaju

      Takashi Toyoshima voted and added 1 comment

      Votes added by Takashi Toyoshima

      Code-Review+0

      1 comment

      Patchset-level comments
      Takashi Toyoshima

      Adam, if you want to avoid the PendingRemote of 1, how about the FilePath with CPSP of 2? We share the same network service process for all profiles including system context. So, UnguessableToken does not make it more secure as it can access it after reading anyway.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Hiroshige Hayashizaki
      • Nidhi Jaju
      Gerrit-Attention: Hiroshige Hayashizaki <hiro...@chromium.org>
      Gerrit-Attention: Nidhi Jaju <nidh...@chromium.org>
      Gerrit-Comment-Date: Thu, 11 Jun 2026 09:30:54 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Alex Moshchuk <ale...@chromium.org>
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      Comment-In-Reply-To: Nidhi Jaju <nidh...@chromium.org>
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages