Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature proposal: COEP/COOP reflection. #7912

Open
ArthurSonzogni opened this issue May 10, 2022 · 4 comments
Open

Feature proposal: COEP/COOP reflection. #7912

ArthurSonzogni opened this issue May 10, 2022 · 4 comments
Labels
addition/proposal New features or enhancements topic: cross-origin-embedder-policy Issues and ideas around the new "require CORP for subresource requests and frames and etc" proposal topic: cross-origin-opener-policy Issues and ideas around the new "inverse of rel=noopener" header

Comments

@ArthurSonzogni
Copy link
Member

ArthurSonzogni commented May 10, 2022

As part of the AnonymousIframe proposal, I am planning to add a way to reflect the COEP policy. However, I would be interested getting your opinions about how such API should look like? I would like to avoid future regrets and get something that would fit nicely together.

No need for COOP reflection for now, but I believe we should think about it anyway, so that both can eventually be used in a consistent manner, if added.

There are already:

window.isSecureContext
window.crossOriginIsolated

If we want to follow a similar pattern, the API could be:

window.crossOriginEmbedderPolicy == 'unsafe-none' | 'credentialless' | 'require-corp'
window.crossOriginOpenerPolicy == 'unsafe-none' | 'same-origin' | 'same-origin-allow-popups'

I am a bit sad about polluting the global object further, and worry about an eventual poor extendability.
Does this shape looks good to you? Would you had opinions about how the API should look like?

+CC @annevk, @domenic, @mikewest, @camillelamy

Motivation:
For trying Anonymous Iframe, Google DisplayAds, needs a way to know the COEP policy. The Ads's script could this way be able to decide in between inserting a normal or anonymous iframe.
Anonymous iframe is the only way for them to insert iframe inside a COEP: require-corp or COEP: credentialless context. However, it comes with the benefits/drawback of starting from a fresh ephemeral context every time.
They would like not to use it when it is not a necessity. They would like not to affect existing clients where this is currently working, the ones not using COEP.

@domenic
Copy link
Member

domenic commented May 10, 2022

This shape looks good to me. The global object is a fine place for new APIs.

@mikewest
Copy link
Member

mikewest commented May 11, 2022

Given that these are all getting wrapped up in a "policy container" concept in HTML, I wonder whether it makes sense to put them together in that form from the developer perspective. That would (eventually) also let us shift things like document.featurePolicy.features and similar into a window.policies(?) container that would only add one item to the global object.

I can imagine that being a little too much, and it's certainly reasonable to just add one-off enums when we need them, but given the value of adding structure to HTML's understanding of these concepts, it makes sense to consider doing the same for developers.

@annevk
Copy link
Member

annevk commented May 11, 2022

I think I saw that anonymous iframes also offers a new request header. That should maybe be discussed at the same time as well as whether we want to expose this state to service workers through the Request object? As in, ideally these all have somewhat compatible shapes and extension points.

@ArthurSonzogni
Copy link
Member Author

ArthurSonzogni commented May 11, 2022

I think I saw that anonymous iframes also offers a new request header.

Indeed, this was in Camille's initial explainer. However it's not implemented and I haven't put it in the specification.

Developers seems interested using a JS API instead. We can do both for sure, but given the cost of sending additional bytes for every subresources, I was wondering if this was really worth it. I was happy deferring it up until somebody really can't do without it.

I don't have a strong opinion about the HTTP header, or the shape of the JS API. Happy to agree with anyone else with a stronger opinion/arguments ;-)

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 20, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 20, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 23, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
aarongable pushed a commit to chromium/chromium that referenced this issue May 23, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655443
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006471}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 23, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655443
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006471}
ArthurSonzogni added a commit to ArthurSonzogni/html that referenced this issue May 23, 2022
Original proposal:
whatwg#7912

WPT tentative tests:
web-platform-tests/wpt#34141
- /html/cross-origin-embedder-policy/reflection-unsafe-none.tentative.https.any.js
- /html/cross-origin-embedder-policy/reflection-credentialless.tentative.https.any.js
- /html/cross-origin-embedder-policy/reflection-require-corp.tentative.https.any.js
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue May 23, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655443
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006471}
@ArthurSonzogni ArthurSonzogni mentioned this issue May 23, 2022
3 tasks
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue May 25, 2022
Automatic update from web-platform-tests
COEP reflection: tentative.

Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655443
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006471}

--

wpt-commits: 6932a460b153af9a2a6c9ba463593f51232d402c
wpt-pr: 34141
jamienicol pushed a commit to jamienicol/gecko that referenced this issue May 25, 2022
Automatic update from web-platform-tests
COEP reflection: tentative.

Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655443
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006471}

--

wpt-commits: 6932a460b153af9a2a6c9ba463593f51232d402c
wpt-pr: 34141
@domenic domenic added addition/proposal New features or enhancements topic: cross-origin-opener-policy Issues and ideas around the new "inverse of rel=noopener" header topic: cross-origin-embedder-policy Issues and ideas around the new "require CORP for subresource requests and frames and etc" proposal labels May 29, 2022
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
Add tentative tests and implementation for:
whatwg/html#7912

This is not the definitive shape, it still requires some community
consensus before behind definitive.

This behind the AnonymousIframe runtime feature.

The current implementation only work when global=window. The
PolicyContainerHost is not plumbed yet at the moment:
https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit

Bug: 1324521
Change-Id: I292dbc5de18151befb956c172d952fb8d8b0217f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655443
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006471}
NOKEYCHECK=True
GitOrigin-RevId: a4ec99ea881a46538b31c78c3c4811b1e60fa285
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: cross-origin-embedder-policy Issues and ideas around the new "require CORP for subresource requests and frames and etc" proposal topic: cross-origin-opener-policy Issues and ideas around the new "inverse of rel=noopener" header
Development

No branches or pull requests

4 participants