Skip to content

Commit 9ada5e5

Browse files
[Spec] Remove references to create in cross origin iframe
The WebAuthn specification now allows credential creation in a cross origin iframe, as of w3c/webauthn#1801. As such, SPC no longer needs to override or add this behavior. We do retain (for now) the ability for the `"payment"` permission policy to allow credential create in an iframe, instead of requiring `"publickey-credentials-create"`. This should be removed one day, but one small step to unification at a time :). There is a small web-compat issue here. In the case of no transient user activation, the SPC specification used to throw a `SecurityError` error. However WebAuthn throws a `NotAllowed` error instead. See also Chrome bug https://crbug.com/41484826 Fixes #267
1 parent 0e2e5c5 commit 9ada5e5

File tree

1 file changed

+30
-90
lines changed

1 file changed

+30
-90
lines changed

spec.bs

Lines changed: 30 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ spec: credential-management-1; urlPrefix: https://w3c.github.io/webappsec-creden
3232
type: dfn
3333
text: same-origin with its ancestors; url: same-origin-with-its-ancestors
3434
text: request a credential; url: abstract-opdef-request-a-credential
35+
text: Create Permissions Policy; url: credential-type-registry-create-permissions-policy
3536

3637
spec: ECMAScript; urlPrefix: https://tc39.github.io/ecma262/#
3738
type: dfn
@@ -195,24 +196,6 @@ These limitations motivate the following Secure Payment Confirmation behaviors:
195196
The current specification is designed to increase the security and usability
196197
of Web payments.
197198

198-
### Registration in a third-party iframe ### {#sctn-use-case-iframe-registration}
199-
200-
If a bank wishes to use [[webauthn-3]] as the [=Relying Party=], that
201-
specification requires the bank to register the user in a first party context.
202-
Registration can happen outside of a transaction while the user is visiting the
203-
bank's site. It is also useful to be able to register the user during a
204-
transaction, but any registration that interrupts the payment journey creates a
205-
risk of transaction abandonment.
206-
207-
This limitation motivates the following Secure Payment Confirmation behavior:
208-
209-
1. SPC supports cross-origin registration from an iframe in a third-party
210-
context. For instance, this registration might take place following some
211-
other identity and verification (<abbr>ID&amp;V</abbr>) flow (e.g., SMS OTP).
212-
213-
* See <a href="https://github.com/w3c/webauthn/issues/1656">discussion
214-
on WebAuthn issue 1656</a>.
215-
216199
### Merchant control of authentication ### {#sctn-use-case-merchant-authentication}
217200

218201
Merchants seek to avoid user drop-off during checkout, in particular by
@@ -256,7 +239,7 @@ an issuing bank during a checkout by the user on some merchant.
256239
merchant to open in an iframe.
257240

258241
1. The merchant opens an iframe to `bank.com`, with the `allow` attribute set to
259-
"[=payment permission string|payment=]".
242+
"[=publickey-credentials-create-feature|publickey-credentials-create=]".
260243

261244
1. In the iframe, the issuing bank confirms the user's identity via a
262245
traditional means (e.g., SMS OTP). After confirmation, the bank invites the
@@ -495,15 +478,11 @@ specified.
495478
</wpt>
496479

497480
Note: In this specification we define an extension in order to allow
498-
(1) credential creation in a cross-origin iframe (which WebAuthn
499-
Levels 1 and 2 do not allow, but Level 3 <a
500-
href="https://github.com/w3c/webauthn/pull/1801">is expected to
501-
allow</a>) and (2) the browser to cache SPC credential IDs in the
502-
absence of [[webauthn-conditional-ui|Conditional UI]]. If these
503-
capabilities are available in future versions of WebAuthn, we
504-
may remove the requirement for the extension from SPC. Note that
505-
SPC credentials (with the extension) are otherwise full-fledged
506-
WebAuthn credentials.
481+
the browser to cache SPC credential IDs in the absence of
482+
[[webauthn-conditional-ui|Conditional UI]]. If this capability is
483+
available in future versions of WebAuthn, we may remove the requirement
484+
for the extension from SPC. Note that SPC credentials (with the extension)
485+
are otherwise full-fledged WebAuthn credentials.
507486

508487
Note: At registration time, Web Authentication requires both
509488
{{PublicKeyCredentialEntity/name}} and
@@ -968,18 +947,22 @@ This [=client extension|client=] [=registration extension=] and
968947
[=authentication extension=] indicates that a credential is either being
969948
created for or used for Secure Payment Confirmation, respectively.
970949

971-
For registration, this extension relaxes the WebAuthn requirements to allow
972-
credential creation in a cross-origin iframe, and also allows the browser to
973-
identify and cache Secure Payment Confirmation credential IDs. For
974-
authentication, this extension allows a third-party to perform an
975-
authentication ceremony on behalf of the [=Relying Party=], and also adds
976-
transaction information to the signed cryptogram.
950+
For registration, this extension allows the browser to identify and cache
951+
Secure Payment Confirmation credential IDs. For authentication, this extension
952+
allows a third-party to perform an authentication ceremony on behalf of the
953+
[=Relying Party=], and also adds transaction information to the signed
954+
cryptogram.
977955

978956
Notably, a website should not call
979957
{{CredentialsContainer/get()|navigator.credentials.get()}} with this extension
980958
directly; for authentication the extension can only be accessed via
981959
{{PaymentRequest}} with a "[=secure-payment-confirmation=]" payment method.
982960

961+
Note: Previously, the `payment` extension allowed for the creation of
962+
credentials in a cross-origin iframe. However that behavior is now
963+
allowed in WebAuthn by default, as of [WebAuthn PR #1801](
964+
https://github.com/w3c/webauthn/pull/1801).
965+
983966
<wpt title="This test does not directly correspond to a spec line, but instead
984967
tests that authentication can be triggered from inside a
985968
cross-origin iframe. That behavior is specified by the lack of any
@@ -1040,38 +1023,15 @@ directly; for authentication the extension can only be accessed via
10401023
: <dfn export>Client extension processing ([=registration extension|registration=])</dfn>
10411024
:: When [[webauthn-3#sctn-createCredential|creating a new credential]]:
10421025

1043-
1. Modify step 2 (the check for *sameOriginWithAncestors*) as follows:
1044-
1045-
* If *sameOriginWithAncestors* is `false`:
1046-
1047-
* If the [=relevant global object=], as determined by the calling
1048-
{{CredentialsContainer/create()}} implementation, does not have
1049-
[=transient activation=]:
1050-
1051-
* Return a {{DOMException}} whose name is "{{SecurityError}}", and
1052-
terminate this algorithm.
1053-
1054-
* [=Consume user activation=] of the [=relevant global object=].
1055-
1056-
<wpt>
1057-
enrollment-in-iframe.sub.https.html
1058-
</wpt>
1059-
1060-
Note: This allows for creating SPC credentials in a cross-origin
1061-
iframe, as long as the correct permission policy is set
1062-
(see [[#sctn-permissions-policy]]). A [=transient activation=] is
1063-
also required in this case to mitigate privacy risks; see
1064-
[[#sctn-security-cross-origin-registration]].
1065-
10661026
1. After step 3, insert the following step:
10671027

10681028
* If any of the following are true:
10691029

1070-
* *options*["{{PublicKeyCredentialCreationOptions/authenticatorSelection}}"]["{{AuthenticatorSelectionCriteria/authenticatorAttachment}}"] is not "{{AuthenticatorAttachment/platform}}".
1071-
* *options*["{{PublicKeyCredentialCreationOptions/authenticatorSelection}}"]["{{AuthenticatorSelectionCriteria/residentKey}}"] is not "{{ResidentKeyRequirement/required}}" or "{{ResidentKeyRequirement/preferred}}".
1072-
* *options*["{{PublicKeyCredentialCreationOptions/authenticatorSelection}}"]["{{AuthenticatorSelectionCriteria/userVerification}}"] is not "{{UserVerificationRequirement/required}}".
1030+
* *pkOptions*["{{PublicKeyCredentialCreationOptions/authenticatorSelection}}"]["{{AuthenticatorSelectionCriteria/authenticatorAttachment}}"] is not "{{AuthenticatorAttachment/platform}}".
1031+
* *pkOptions*["{{PublicKeyCredentialCreationOptions/authenticatorSelection}}"]["{{AuthenticatorSelectionCriteria/residentKey}}"] is not "{{ResidentKeyRequirement/required}}" or "{{ResidentKeyRequirement/preferred}}".
1032+
* *pkOptions*["{{PublicKeyCredentialCreationOptions/authenticatorSelection}}"]["{{AuthenticatorSelectionCriteria/userVerification}}"] is not "{{UserVerificationRequirement/required}}".
10731033

1074-
then return a {{TypeError}}.
1034+
then throw a {{TypeError}}.
10751035

10761036
Note: These values are hard-coded as that is what Chrome's initial implementation
10771037
supports. The current limitations may change. The Working Group invites implementers
@@ -1249,9 +1209,15 @@ contains the following members:
12491209
# Permissions Policy integration # {#sctn-permissions-policy}
12501210

12511211
This specification uses the "[=payment permission string|payment=]"
1252-
policy-identifier string from [[payment-request]] to control access to **both**
1253-
registration and authentication. This extends the
1254-
[[webauthn-3#sctn-permissions-policy|WebAuthn Permission Policy]].
1212+
policy-identifier string from [[payment-request]] to control access to
1213+
SPC authentication, as per the {{PaymentRequest}} constructor.
1214+
1215+
For backwards compatibility with an earlier version of this specification, the
1216+
[[credential-management-1#sctn-cred-type-registry|Credential Management
1217+
Credential Type Registry]] is extended to add the "[=payment permission
1218+
string|payment=]" policy-identifier string as an alternative [=Create
1219+
Permissions Policy=] for type `public-key`. A future version of this
1220+
specification may deprecate this behavior entirely.
12551221

12561222
<wpt>
12571223
enrollment-in-iframe.sub.https.html
@@ -1532,32 +1498,6 @@ applicable. The below subsections comprise the current Secure Payment
15321498
Confirmation-specific privacy considerations, where this specification diverges
15331499
from WebAuthn.
15341500

1535-
## Registration in a Cross-Origin iframe ## {#sctn-security-cross-origin-registration}
1536-
1537-
Unlike WebAuthn, this specification allows the creation of credentials in a
1538-
cross-origin iframe (as long as the appropriate
1539-
[[#sctn-permissions-policy|Permission Policy]] is set on the iframe). That is,
1540-
if site A embeds an iframe from site B, with the "[=payment permission
1541-
string|payment=]" policy set, then site B may initiate a credential creation
1542-
for site B within that iframe.
1543-
1544-
NOTE: Allowing credential creation in cross-origin iframes is currently [under
1545-
discussion](https://github.com/w3c/webauthn/issues/1656) in the WebAuthn
1546-
Working Group, and thus may move from this specification to WebAuthn in
1547-
the future.
1548-
1549-
Allowing credential creation in a cross-origin iframe presents a risk that an
1550-
iframe may attempt to trick a user into registering a credential. That
1551-
credential could then be used for tracking (see [WebAuthn issue
1552-
1656](https://github.com/w3c/webauthn/issues/1656)). To mitigate such an
1553-
attack, this specification requires that a call to
1554-
{{CredentialsContainer/create()|navigator.credentials.create()}} inside a
1555-
cross-origin iframe may only be invoked when the iframe has [=transient
1556-
activation=] (e.g., via a click or press from the user).
1557-
1558-
NOTE: Requiring user activation for WebAuthn APIs in general is under discussion
1559-
in the WebAuthn WG too; see [issue #1293](https://github.com/w3c/webauthn/issues/1293).
1560-
15611501
## Probing for credential ids ## {#sctn-privacy-probing-credential-ids}
15621502

15631503
As per WebAuthn's section on [[webauthn-3#sctn-assertion-privacy|Authentication

0 commit comments

Comments
 (0)