Passkeys: Permissions Policy support#2862
Conversation
aea8ac5 to
16cd5e0
Compare
| * @param {'create' | 'get'} action | ||
| * @returns {boolean} | ||
| */ | ||
| const isAllowedByPolicy = function (action) { |
There was a problem hiding this comment.
Doesn't this function override the iframe check? https://www.w3.org/TR/webauthn-2/#sctn-iframe-guidance
You allow a cross-origin iframe here automatically if the document has allowed a permission policy. It should be first checked if the current script is inside a cross-origin iframe and then check the permission policy.
There was a problem hiding this comment.
iframe's allow attribute is a part of Permissions Policy.
Please read information on these 2 marked links.
https://www.w3.org/TR/webauthn-2/#sctn-iframe-guidance:~:text=the-,publickey%2Dcredentials%2Dget&text=in%20the-,allow
There was a problem hiding this comment.
Yes, that's with the iframe element. Your change does not check if the current script is inside iframe or is it at the main document.
There was a problem hiding this comment.
iframe'sallowattribute is a part of Permissions policy.- The browser has reported that requests are allowed by Permissions policy.
Why do I need additional verification here?
There was a problem hiding this comment.
Let's say the current script is inside an iframe. The main document has allowed WebAuthn to be used from this iframe. I introduced an additional check and found that the script is inside this iframe. What should I do with that information? Block the request? The specification, however, says the request must be allowed. It doesn't forbid such requests entirely. It forbids them by default (without an explicit indication on the main document's side that it's permitted).
There was a problem hiding this comment.
Yes, but I think the script should do that check only if we are inside a cross-origin iframe.
There was a problem hiding this comment.
In this case, only § 5.10 would be implemented, and all related PR issues would be resolved.
However, § 5.9 would not be implemented. A site can completely prohibit the use of WebAuthn via Permissions-Policy: publickey-credentials-get=() HTTP header, but that restriction won’t be enforced in the main document - as it currently stands.
There was a problem hiding this comment.
According to the documentation, 5.9 is done only for publickey-credentials-get but this change does it for create too.
There was a problem hiding this comment.
WebAuthn‑3 includes the create feature.
https://www.w3.org/TR/webauthn-3/#sctn-permissions-policy
As I understand it, you’re concerned that some older browser doesn’t know about create and will always return false. I’ll add an additional check.
Support of:
Both legacy and draft APIs are used. If a browser doesn't support either of these, fallback to
sameOriginWithAncestorsmode.Important
Firefox users need to go to
about:config, finddom.security.featurePolicy.webidl.enabledand toggle it totrue.Testing strategy
isAllowedByPolicy() === true.Type of change