Add API to create origins from nonces for sandboxed iframes [chromium/src : main]

0 views
Skip to first unread message

Liang Zhao (Gerrit)

unread,
Dec 8, 2025, 1:18:40 PM (8 days ago) Dec 8
to Monica Chintala, Rakina Zata Amni, AyeAye, Dave Risney, Chromium IPC Reviews, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, edg...@microsoft.com, alexmo...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Dave Risney, Monica Chintala and Rakina Zata Amni

Liang Zhao added 1 comment

File content/common/sandboxed_opaque_origin_creator.cc
Line 13, Patchset 19 (Latest):url::Origin SandboxedOpaqueOriginCreator::CreateOriginForSandboxedFrame(
Liang Zhao . unresolved

Should we add some unit tests for the new functions?

Open in Gerrit

Related details

Attention is currently required from:
  • Dave Risney
  • Monica Chintala
  • Rakina Zata Amni
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: I0acceb30370940fecf16d8f027b0d78e34af5b8d
Gerrit-Change-Number: 7146577
Gerrit-PatchSet: 19
Gerrit-Owner: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Liang Zhao <lz...@microsoft.com>
Gerrit-Reviewer: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Dave Risney <david....@microsoft.com>
Gerrit-CC: gwsq
Gerrit-Attention: Dave Risney <david....@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Comment-Date: Mon, 08 Dec 2025 18:18:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Rakina Zata Amni (Gerrit)

unread,
Dec 9, 2025, 12:23:56 AM (8 days ago) Dec 9
to Monica Chintala, Daniel Cheng, AyeAye, Liang Zhao, Dave Risney, Chromium IPC Reviews, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, edg...@microsoft.com, alexmo...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Dave Risney and Monica Chintala

Rakina Zata Amni added 6 comments

Patchset-level comments
File-level comment, Patchset 19 (Latest):
Rakina Zata Amni . resolved

Thanks! Let me add @dch...@chromium.org to review as well, since he commented on this work a while back.

File content/common/sandboxed_opaque_origin_creator.cc
Line 13, Patchset 19 (Latest):url::Origin SandboxedOpaqueOriginCreator::CreateOriginForSandboxedFrame(
Liang Zhao . unresolved

Should we add some unit tests for the new functions?

Rakina Zata Amni

+1

File third_party/blink/renderer/platform/weborigin/sandboxed_opaque_security_origin_creator.h
Line 23, Patchset 19 (Latest): // given nonce and URL
Rakina Zata Amni . unresolved

I wonder if this should be removed, if we will only ever pass in `about:blank`. Are there other cases not covered here? (e.g. does `about:srcdoc` or `data:` URLs have the same problem?)

File third_party/blink/renderer/platform/weborigin/security_origin.cc
Line 310, Patchset 19 (Latest): if (url.IsValid() && !ShouldTreatAsOpaqueOrigin(url)) {
Rakina Zata Amni . unresolved

Are precursors never opaque? What happens if we pass in an opaque precursor anyways?

Line 310, Patchset 19 (Latest): if (url.IsValid() && !ShouldTreatAsOpaqueOrigin(url)) {
Rakina Zata Amni . unresolved

Can we make this a CHECK instead? Or are there actually cases where it's possible to pass an invalid URL here?

File url/origin.h
Line 184, Patchset 19 (Latest): // Creates an origin with the given nonce and tuple.
Rakina Zata Amni . unresolved

Let's add a comment on what the intended use case is (about:blank sandboxed iframes), and how we don't plan to add any more use cases here.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Dave Risney
  • Monica Chintala
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: I0acceb30370940fecf16d8f027b0d78e34af5b8d
Gerrit-Change-Number: 7146577
Gerrit-PatchSet: 19
Gerrit-Owner: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Liang Zhao <lz...@microsoft.com>
Gerrit-Reviewer: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Dave Risney <david....@microsoft.com>
Gerrit-CC: gwsq
Gerrit-Attention: Dave Risney <david....@microsoft.com>
Gerrit-Attention: Monica Chintala <moni...@microsoft.com>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Dec 2025 05:23:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Liang Zhao <lz...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniel Cheng (Gerrit)

unread,
Dec 9, 2025, 1:04:22 PM (7 days ago) Dec 9
to Monica Chintala, Daniel Cheng, Rakina Zata Amni, AyeAye, Liang Zhao, Dave Risney, Chromium IPC Reviews, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, edg...@microsoft.com, alexmo...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Dave Risney and Monica Chintala

Daniel Cheng added 1 comment

Patchset-level comments
Daniel Cheng . unresolved

How many places are going to need to call this? It's hard to tell because none of those uses were introduced in this CL, so I can't really tell if the new abstractions/passkeys make sense (as opposed to just using existing methods like `CreateOpaqueFromNormalizedPrecursorTuple()`).

I'm actually not sure how much the passkeys help: while they won't be able to call the creation methods on SecurityOrigin/Origin directly, they can just call the helpers directly instead.

Open in Gerrit

Related details

Attention is currently required from:
  • Dave Risney
  • Monica Chintala
Gerrit-Comment-Date: Tue, 09 Dec 2025 18:04:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Chintala (Gerrit)

unread,
Dec 10, 2025, 6:43:55 PM (6 days ago) Dec 10
to Daniel Cheng, Rakina Zata Amni, AyeAye, Liang Zhao, Dave Risney, Chromium IPC Reviews, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, edg...@microsoft.com, alexmo...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Dave Risney and Rakina Zata Amni

Monica Chintala added 4 comments

Patchset-level comments
Daniel Cheng . unresolved

How many places are going to need to call this? It's hard to tell because none of those uses were introduced in this CL, so I can't really tell if the new abstractions/passkeys make sense (as opposed to just using existing methods like `CreateOpaqueFromNormalizedPrecursorTuple()`).

I'm actually not sure how much the passkeys help: while they won't be able to call the creation methods on SecurityOrigin/Origin directly, they can just call the helpers directly instead.

Monica Chintala

There are only two places where we call it (RenderFrameHostImpl::SetOriginDependentStateOfNewFrame and
DocumentLoader::CalculateOrigin) and the usage is in the next CL's.

This wrapper provides a single point for origin creation with nonces. To prevent misuse, I agree that we need to restrict via PassKey here as well. Added now! What do you think now?

CreateOpaqueFromNormalizedPrecursorTuple is private so cannot be used as an alternative.

File third_party/blink/renderer/platform/weborigin/sandboxed_opaque_security_origin_creator.h
Line 23, Patchset 19: // given nonce and URL
Rakina Zata Amni . unresolved

I wonder if this should be removed, if we will only ever pass in `about:blank`. Are there other cases not covered here? (e.g. does `about:srcdoc` or `data:` URLs have the same problem?)

Monica Chintala

New opaque origin generation is used by all Sandboxed Iframes (about:blank, about:srcdoc, data:, blob, initial empty etc) so we should keep it.

File third_party/blink/renderer/platform/weborigin/security_origin.cc
Line 310, Patchset 19: if (url.IsValid() && !ShouldTreatAsOpaqueOrigin(url)) {
Rakina Zata Amni . unresolved

Can we make this a CHECK instead? Or are there actually cases where it's possible to pass an invalid URL here?

Monica Chintala

I think we should keep it conditional. Invalid urls can still happen for opaque origins(when iframe created from sandboxed about:blank iframe). KURL would be null here when we be extract the origin url from the callers like below:

KURL(origin->GetOriginOrPrecursorOriginIfOpaque()
->ToUrlOrigin()
.GetURL())
Line 310, Patchset 19: if (url.IsValid() && !ShouldTreatAsOpaqueOrigin(url)) {
Rakina Zata Amni . unresolved

Are precursors never opaque? What happens if we pass in an opaque precursor anyways?

Monica Chintala

Precursors are generally non-opaque. If opaque precursors happen somehow, it creates opaque without precursor as ShouldTreatAsOpaqueOrigin returns true and skips CreateInternal . This code is added for defensive to handle opaque cases if any.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Dave Risney
  • Rakina Zata Amni
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: I0acceb30370940fecf16d8f027b0d78e34af5b8d
Gerrit-Change-Number: 7146577
Gerrit-PatchSet: 21
Gerrit-Owner: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Liang Zhao <lz...@microsoft.com>
Gerrit-Reviewer: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Dave Risney <david....@microsoft.com>
Gerrit-CC: gwsq
Gerrit-Attention: Dave Risney <david....@microsoft.com>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Comment-Date: Wed, 10 Dec 2025 23:43:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
Comment-In-Reply-To: Rakina Zata Amni <rak...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Monica Chintala (Gerrit)

unread,
12:39 PM (10 hours ago) 12:39 PM
to Daniel Cheng, Rakina Zata Amni, AyeAye, Liang Zhao, Dave Risney, Chromium IPC Reviews, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, edg...@microsoft.com, alexmo...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Dave Risney, Liang Zhao and Rakina Zata Amni

Monica Chintala added 1 comment

File content/common/sandboxed_opaque_origin_creator.cc
Line 13, Patchset 19:url::Origin SandboxedOpaqueOriginCreator::CreateOriginForSandboxedFrame(
Liang Zhao . resolved

Should we add some unit tests for the new functions?

Rakina Zata Amni

+1

Monica Chintala

Added. PTAL, thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Dave Risney
  • Liang Zhao
  • Rakina Zata Amni
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: I0acceb30370940fecf16d8f027b0d78e34af5b8d
Gerrit-Change-Number: 7146577
Gerrit-PatchSet: 23
Gerrit-Owner: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Liang Zhao <lz...@microsoft.com>
Gerrit-Reviewer: Monica Chintala <moni...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: Dave Risney <david....@microsoft.com>
Gerrit-CC: gwsq
Gerrit-Attention: Dave Risney <david....@microsoft.com>
Gerrit-Attention: Liang Zhao <lz...@microsoft.com>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Dec 2025 17:39:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Liang Zhao <lz...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages