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

Fix #364: Integrate EME with Feature Policy #432

Closed
wants to merge 3 commits into from

Conversation

raymeskhoury
Copy link

@raymeskhoury raymeskhoury commented Oct 4, 2017

This adds a section defining the feature name and default allowlist, as well as integration with the requestMediaKeySystemAccess algorithm.


Preview | Diff

This adds a section defining the feature name and default allowlist, as
well as integration with the requestMediaKeySystemAccess algorithm.
@raymeskhoury
Copy link
Author

raymeskhoury commented Oct 4, 2017

@clelland we still need to fix the "allowed to use" monkey-patch to make it take a policy-controlled feature. Is that something you could do?

@ddorwin ptal - I'm sure I've violated some style conventions but help would be appreciated in how to do things right - I'm not very experienced with this stuff!

I'm also in the process of getting a W3C account linked...

@@ -657,9 +669,10 @@

<ol class="method-algorithm">
<!-- TODO: Convert all parameters to use <code>. -->
<li><p>Let <var>document</var> be the calling context's <a def-id="document-concept"></a>.</p></li>
<li><p>If <var>document</var> is not <a data-cite="!HTML#allowed-to-use">allowed to use</a> the <a data-cite="!FEATURE-POLICY#policy-controlled-feature">policy-controlled feature</a> named <a>encrypted-media</a>, return a promise rejected with a newly created <a def-id="NotSupportedError"></a>.</p></li>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a SecurityError as recommended in https://github.com/WICG/feature-policy/blob/gh-pages/integration.md. I actually think SecurityError is more appropriate but there may be backward compatibility concerns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's probably fine. NotSupportedError is an expected result that needs to be handled, but nothing is going to work in this case anyway.

@xhwang-chromium, we'll need to update Chromium if this changes (along with the actual algorithm steps).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry just to clarify: which do you prefer - NotSupportedError or SecurityError?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with SecurityError if that is what other specs are using.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web-platform-tests/wpt#7889 assumes SecurityError.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raymeskhoury
Copy link
Author

@ddorwin ping :)

@ddorwin ddorwin changed the title Integrate EME with Feature Policy Fix #364: Integrate EME with Feature Policy Oct 10, 2017
Copy link
Contributor

@ddorwin ddorwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Looks good overall. We'll also need to update index.html before landing.

I updated the PR title to refer to the issue. You'll need to make sure the eventual commit message matches that (or I can do the merge).

On the process side, EME is now a Recommendation, so it's not clear how we should handle such post-REC changes in the repo. This is not really a new feature, simply patches the algorithm to align with another spec, and further enhances the user security and privacy mitigations in this spec, but it is observable. /cc @plehegar

@@ -657,9 +669,10 @@

<ol class="method-algorithm">
<!-- TODO: Convert all parameters to use <code>. -->
<li><p>Let <var>document</var> be the calling context's <a def-id="document-concept"></a>.</p></li>
<li><p>If <var>document</var> is not <a data-cite="!HTML#allowed-to-use">allowed to use</a> the <a data-cite="!FEATURE-POLICY#policy-controlled-feature">policy-controlled feature</a> named <a>encrypted-media</a>, return a promise rejected with a newly created <a def-id="NotSupportedError"></a>.</p></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's probably fine. NotSupportedError is an expected result that needs to be handled, but nothing is going to work in this case anyway.

@xhwang-chromium, we'll need to update Chromium if this changes (along with the actual algorithm steps).

@@ -620,6 +620,18 @@
</dl>
</section>

<section>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a new top-level section, which seems a bit odd. Also, it is specific to a single method, which is defined in the next top-level section. Should it be part of that? How do other APIs handle this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure where to put it some I'm open to suggestions. I don't think there is any standard place right now but @clelland may have thoughts. I'll move it to the next section.

@raymeskhoury
Copy link
Author

Thanks - please let me know how to update index.html.

I'm happy for you to do the merge if it's easier.

@ddorwin
Copy link
Contributor

ddorwin commented Oct 12, 2017

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 18, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 19, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 22, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 22, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 24, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
@raymeskhoury
Copy link
Author

Updated index.html. Note that it changed massively. I'm not sure if I did something wrong or if it is a new version of respec or something. But it changed just as much when I produced a snapshot from top-of-tree. Let me know if I'm missing something!

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 24, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
Reviewed-on: https://chromium-review.googlesource.com/727319
Reviewed-by: Timothy Loh <timloh@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Raymes Khoury <raymes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511051}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 24, 2017
This changes the type of error returned to be a SecurityError, as
discussed in w3c/encrypted-media#432 (review).

This also makes 3 other small changes:
1) The deprecation warning is only shown when the feature is not
enabled.
2) A separate console message is logged when a request has been rejected
due to a Feature Policy in effect.
3) A UseCounter also counts the number of times that a request is
rejected due to Feature Policy.

Bug: 689802
Change-Id: Ic067fea9df858ba5390f74073e67a350043fe8ce
Reviewed-on: https://chromium-review.googlesource.com/727319
Reviewed-by: Timothy Loh <timloh@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Raymes Khoury <raymes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511051}
@plehegar plehegar self-assigned this Oct 24, 2017
@plehegar
Copy link
Member

(to answer David's question)

@plehegar
Copy link
Member

Feature Policy is still being developed so isn't yet suitable as a normative reference in a W3C Recommendation, so we wouldn't be able to push a new Edited Recommendation with it.
Once it becomes more stable, it's only adding a restriction so, from an IPR perspective, that's fine (cc @wseltzer ). As long as the change gets properly reviewed, we'd be good to go.

@Malvoz
Copy link

Malvoz commented Aug 4, 2019

Friendly bump, other W3C recommendations such as https://www.w3.org/TR/payment-request/#feature-policy are now integrating this.

@joeyparrish
Copy link
Member

Any objections to my merging this now (with an update to index.html)?

@ddorwin
Copy link
Contributor

ddorwin commented Nov 18, 2019

It looks like there is an open question of NotSupportedError vs SecurityError in the inline comments.

@joeyparrish
Copy link
Member

It looks like there is an open question of NotSupportedError vs SecurityError in the inline comments.

The latest from that discussion was you saying you were fine with SecurityError and foolip saying that WPT expects it. So I assumed that was settled.

@joeyparrish
Copy link
Member

JFYI, the "as defined by" part was being rejected by respec as it couldn't resolve the reference to "Feature Policy". I couldn't figure out the syntax to fix it, but I realized it was redundant, since the sentence already links to the definition in the Feature Policy spec. So with that removed and index.html regenerated, this merges cleanly.

I'll leave this open for another day to see if anybody has further comment. If not, I'll merge it. If I merge it and someone comes along later and says I missed something, we'll fix it.

Thanks!

Copy link
Contributor

@ddorwin ddorwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is an open question of NotSupportedError vs SecurityError in the inline comments.

The latest from that discussion was you saying you were fine with SecurityError and foolip saying that WPT expects it. So I assumed that was settled.

I had had hoped for a confirmation of "that is what other specs are using" and read the WPT comment as more of an observation than authoritative. :) That said, SecurityError appears to be the recommendation from the integration doc, so SGTM.

@@ -657,9 +669,10 @@

<ol class="method-algorithm">
<!-- TODO: Convert all parameters to use <code>. -->
<li><p>Let <var>document</var> be the calling context's <a def-id="document-concept"></a>.</p></li>
<li><p>If <var>document</var> is not <a data-cite="!HTML#allowed-to-use">allowed to use</a> the <a data-cite="!FEATURE-POLICY#policy-controlled-feature">policy-controlled feature</a> named <a>encrypted-media</a>, return a promise rejected with a newly created <a def-id="NotSupportedError"></a>.</p></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeyparrish
Copy link
Member

Updated link: https://github.com/w3c/webappsec-feature-policy/blob/master/integration.md#referencing-the-feature-policy-spec

Thanks! I've updated my local copy to reflect all of this, including the switch to SecurityError.

@joeyparrish
Copy link
Member

Since my local diff against master is fairly small and easy to verify against the latest referencing guidelines, I'll go ahead and merge it now. I'd be happy to follow-up on any changes I missed, or review another PR if someone wants to make additional changes for this.

Thank you @raymeskhoury for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants