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

Allow for credential creation in a cross-origin iframe #1801

Merged

Conversation

stephenmcgruer
Copy link
Contributor

@stephenmcgruer stephenmcgruer commented Sep 14, 2022

See #1656

This PR adds the ability to call navigator.credentials.create() in a cross-origin
iframe (more exactly, a frame that is not same-origin with its ancestor chain),
as long as the following conditions are met:

  • The iframe has a publickey-credentials-create-feature permission policy
  • The iframe has a user activation

It has a corresponding PR on the credential management spec; see
w3c/webappsec-credential-management#209


Preview | Diff

@stephenmcgruer
Copy link
Contributor Author

cc @ve7jtb , who I believe wished to make sure that this was compatible with the previous L2 discussion on what create() in a cross-origin iframe would look like (particularly the permission policy name, I believe).

@stephenmcgruer
Copy link
Contributor Author

stephenmcgruer commented Sep 28, 2022

This pull request was discussed at the Sept 21st, 2022 WebAuthn WG meeting. During that meeting, we heard the following concerns from Apple (and please @pascoej , correct me if I am misrepresenting your comments!)

  1. If a user registers a passkey in a payment flow, and later sees it in the password manager, they may be confused.
  2. If a user registers a passkey in a payment flow, but then later the bank asks them to use that passkey to sign-in with, they may be confused.
  3. If an iframe can trigger passkey creation, the user will not know what site it is for.
  4. This enables the tracking concern as described here.

I'd like to start by repeating (as we said in the meeting) that these concerns are not invalid and we appreciate where you are coming from.

For 1 and 2; it is already the case today that a Relying Party could register a passkey for a purpose other than sign-in, and utilize it as so. Taking payment as an example; when visiting bank.com I could be asked to 'enroll a passkey to validate future payments when making online purchases'. Even though I was told by the Relying Party that it was for future payments only, that passkey would still show up in the password manager, and the bank could use it to do sign-in. This PR does not change that status quo.

(There is also a deeper purpose discussion here; should WebAuthn be confined to sign-in and attempt - as much as it can[0] - to force Relying Parties down that road. Or, should WebAuthn take the view that passkeys are a verification method only, and what they are verifying is out of scope.)

For 3, it is already possible today to produce a flow with pop-ups that is very close to what this PR enables. An iframe can, with user activation: open a pop-up window, immediately trigger credential.create() in that pop-up, and then close the pop-up instantly after completion. On desktop the pop-up can be made to be almost completely hidden, and on mobile the 'greying' of the screen for the passkey UX obscures the new origin in the URL bar. This demo site should demonstrate this—it has been tested on Chrome 105 and Safari 16.0 on MacOS, Chrome 105 on Android, and Safari on iOS 16.0. Given the existing situation and the ability of the browser to display additional UX for the iframe case if it wishes (see below), we do not think this PR significantly changes the status quo.

Finally, for 4, as per the issue comment we acknowledge the slight increase in risk here, but believe that a combination of:

  1. Requiring a permission policy,
  2. Requiring a user activation, and
  3. The friction of a WebAuthn operation (tracking is usually near silent - WebAuthn is not!)

provides adequate defence. A browser could also, if it wished, add additional or clearer UX to warn the user that the create is occurring in an iframe.

[0] I think the only real mechanism for this is the client/authenticator UI, incidentally. I don't believe there is a feasible way at the API level to constrain to sign-in.

@stephenmcgruer
Copy link
Contributor Author

Hi folks; I had hoped to bring this PR up on today's call, but since it is cancelled pinging here instead. We are still waiting on a response here from Apple, and I would love to have that for next WebAuthn WG meeting if possible (2022/11/16). If there is no answer by the 16th (or during the call), I will be interested to know how the WebAuthn WG wants to proceed at that time (i.e., what the method is to resolve this PR one way or another).

@nadalin nadalin requested review from akshayku and agl November 16, 2022 20:16
@nadalin nadalin added this to the L3-WD-01 milestone Nov 16, 2022
@nadalin nadalin requested review from daniel-montalvo and dveditz and removed request for daniel-montalvo November 16, 2022 20:23
@nadalin nadalin requested a review from ve7jtb November 30, 2022 20:16
Copy link
Contributor

@agl agl left a comment

Choose a reason for hiding this comment

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

I might even skip the TODO. I'm not sure that we'll be in a better place to resolve it in the future and it's clear that implementations have managed to figure out user activation in these contexts already.

@stephenmcgruer
Copy link
Contributor Author

I might even skip the TODO. I'm not sure that we'll be in a better place to resolve it in the future and it's clear that implementations have managed to figure out user activation in these contexts already.

Ack - done, removed the TODO in eb32a68

@rlin1
Copy link
Contributor

rlin1 commented Dec 5, 2022

Lgtm

@timcappalli timcappalli self-requested a review December 14, 2022 20:06
@stephenmcgruer
Copy link
Contributor Author

Post-vacations ping to @akshayku @timcappalli @ve7jtb - could you review this before this week's WebAuthn sync? (I.e. before the 11th). I'd like to get this merged.

@timcappalli
Copy link
Member

Post-vacations ping to @akshayku @timcappalli @ve7jtb - could you review this before this week's WebAuthn sync? (I.e. before the 11th). I'd like to get this merged.

@stephenmcgruer, we may need one more WG meeting cycle due to holidays and vacations. Sorry for the delay.

Copy link
Contributor

@ve7jtb ve7jtb 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 good but I think the containing page info should probably be added to client data.

@stephenmcgruer
Copy link
Contributor Author

(This PR was discussed in the Jan 11 WebAuthn WG meeting. Overall it seems good, but @timcappalli intends to add a comment to request two changes to the PR - one in line with @ve7jtb's suggestion and one additional UX 'should' advisory.)

@stephenmcgruer stephenmcgruer force-pushed the smcgruer/publickey-credentials-create branch from eb32a68 to 1bdab8c Compare January 18, 2023 17:46
@stephenmcgruer
Copy link
Contributor Author

@timcappalli @ve7jtb - I've gone ahead and pushed two commits to this PR that add a note on the client making it clear to the user if the credential creation is in a cross-origin iframe, and also added a topOrigin member to convey some sense of the containing page info (though one could have a chain of different origins of course, and this wouldn't be represented).

Hope this is somewhat along the lines of what you were each thinking - but if not no worries, happy to revise to whatever feedback you have :)

index.bs Outdated Show resolved Hide resolved
Copy link
Contributor Author

@stephenmcgruer stephenmcgruer left a comment

Choose a reason for hiding this comment

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

Thanks for the review!

index.bs Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
Copy link
Member

@emlun emlun left a comment

Choose a reason for hiding this comment

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

Thanks @stephenmcgruer!

@nsatragno nsatragno merged commit 3ff766e into w3c:main Mar 1, 2023
@nsatragno
Copy link
Member

(Merging as this is all green & blocking w3c/webappsec-credential-management#209 and some other work, feel free to open an issue for outstanding issues)

github-actions bot added a commit that referenced this pull request Mar 1, 2023
SHA: 3ff766e
Reason: push, by nsatragno

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
index.bs Show resolved Hide resolved
ianbjacobs added a commit to w3c/secure-payment-confirmation that referenced this pull request May 10, 2023
add mention and link to an informative Note
a note and link
 w3c/webauthn#1801
@stephenmcgruer stephenmcgruer deleted the smcgruer/publickey-credentials-create branch May 10, 2023 22:00
stephenmcgruer pushed a commit to w3c/secure-payment-confirmation that referenced this pull request May 10, 2023
…n registration #243

Add to an informative Note that WebAuthn Levels 1 and 2 do not support cross-origin registration, but level 3 is expected to, and link to pull request:
 w3c/webauthn#1801
aarongable pushed a commit to chromium/chromium that referenced this pull request Dec 18, 2023
As of w3c/webauthn#1801, the WebAuthn spec
allows for credential creation in a cross-origin iframe, as long as
the "publickey-credentials-create" permission policy is set AND
there is a user activation for the call. Previously, Chrome supported
this but only for 'payment' WebAuthn credentials*, which also used
a different permission policy ("payment").

This CL updates Chrome to support calling credentials.create() for
a publickey in a cross-origin iframe, as long as the above conditions
are met. The behavior is behind a runtime-enabled flag,
WebAuthnAllowCreateInCrossOriginFrame, which is currently set to
"experimental". It will be set to stable once we have an approved
I2S for this feature.

This CL does NOT update the behavior for "payment" extension
credentials, which still require the "payment" permission policy
for now. crbug.com/1512605 and crbug.com/1512245 track the
required changes there.

* That is, credential creation calls in which the payment extension
  is specified.

Bug: 1420639
Change-Id: Ic016f074cf0983206a4b2d5fc91e9675756cd159
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5013987
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1238797}
@prnk28
Copy link

prnk28 commented Dec 18, 2023

LFG 🚀

stephenmcgruer added a commit to web-platform-tests/wpt that referenced this pull request Dec 19, 2023
stephenmcgruer added a commit to web-platform-tests/wpt that referenced this pull request Dec 20, 2023
stephenmcgruer added a commit to web-platform-tests/wpt that referenced this pull request Jan 18, 2024
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jan 21, 2024
…eate(), a=testonly

Automatic update from web-platform-tests
[WebAuthn] Add tests for cross-origin create() (#43729)

See w3c/webauthn#1801
--

wpt-commits: d46f1aec78700b30ec633165cd51af2fd90bf3b6
wpt-pr: 43729
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jan 22, 2024
…eate(), a=testonly

Automatic update from web-platform-tests
[WebAuthn] Add tests for cross-origin create() (#43729)

See w3c/webauthn#1801
--

wpt-commits: d46f1aec78700b30ec633165cd51af2fd90bf3b6
wpt-pr: 43729

UltraBlame original commit: 7533e06bd4f5950829eb0eb456a416b37d06e7bf
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jan 22, 2024
…eate(), a=testonly

Automatic update from web-platform-tests
[WebAuthn] Add tests for cross-origin create() (#43729)

See w3c/webauthn#1801
--

wpt-commits: d46f1aec78700b30ec633165cd51af2fd90bf3b6
wpt-pr: 43729

UltraBlame original commit: 7533e06bd4f5950829eb0eb456a416b37d06e7bf
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jan 22, 2024
…eate(), a=testonly

Automatic update from web-platform-tests
[WebAuthn] Add tests for cross-origin create() (#43729)

See w3c/webauthn#1801
--

wpt-commits: d46f1aec78700b30ec633165cd51af2fd90bf3b6
wpt-pr: 43729

UltraBlame original commit: 7533e06bd4f5950829eb0eb456a416b37d06e7bf
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jan 23, 2024
…eate(), a=testonly

Automatic update from web-platform-tests
[WebAuthn] Add tests for cross-origin create() (#43729)

See w3c/webauthn#1801
--

wpt-commits: d46f1aec78700b30ec633165cd51af2fd90bf3b6
wpt-pr: 43729
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.