Skip to content

Passkeys: Permissions Policy support#2862

Open
a2kolbasov wants to merge 2 commits into
keepassxreboot:developfrom
a2kolbasov:passkeys/permissions-policy
Open

Passkeys: Permissions Policy support#2862
a2kolbasov wants to merge 2 commits into
keepassxreboot:developfrom
a2kolbasov:passkeys/permissions-policy

Conversation

@a2kolbasov
Copy link
Copy Markdown
Contributor

@a2kolbasov a2kolbasov commented Feb 7, 2026

Support of:

Both legacy and draft APIs are used. If a browser doesn't support either of these, fallback to sameOriginWithAncestors mode.

Important

Firefox users need to go to about:config, find dom.security.featurePolicy.webidl.enabled and toggle it to true.

Testing strategy

  1. In Chrome and Firefox on https://account.aliyun.com/login/login.htm via debugger checked that isAllowedByPolicy() === true.
  2. In Firefox on https://accountscenter.facebook.com/passkey/management created a passkey.
  3. In Chrome and Firefox on https://bafkreibpvliu64zcxj5uvu4a5ha3oxy4mgtmrylkmdtrfo6w6y2pprmjr4.ipfs.dweb.link/

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)
  • ✅ New feature (change that adds functionality)

@a2kolbasov a2kolbasov marked this pull request as ready for review February 7, 2026 00:28
@varjolintu varjolintu self-requested a review February 7, 2026 04:43
@a2kolbasov a2kolbasov force-pushed the passkeys/permissions-policy branch from aea8ac5 to 16cd5e0 Compare May 20, 2026 23:00
* @param {'create' | 'get'} action
* @returns {boolean}
*/
const isAllowedByPolicy = function (action) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

@a2kolbasov a2kolbasov May 21, 2026

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. iframe's allow attribute is a part of Permissions policy.
  2. The browser has reported that requests are allowed by Permissions policy.

Why do I need additional verification here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but I think the script should do that check only if we are inside a cross-origin iframe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to the documentation, 5.9 is done only for publickey-credentials-get but this change does it for create too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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.

KeepassXC Browser extenstion Fails to save Agekey passkey Aliyun cannot log in with KeePassXC's passkey

2 participants