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

Use Permissions Policy instead of sameOriginWithAncestors #236

Merged
merged 2 commits into from
Aug 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,11 @@ This [=internal method=] accepts three arguments:
:: This argument is a Boolean value which is [TRUE] if and only if the
caller's [=environment settings object=] is
[=same-origin with its ancestors=]. It is [FALSE] if caller is cross-origin.

Note: Invocation of this [=internal method=] indicates that it was allowed by
[=permissions policy=], which is evaluated at the [[!CREDENTIAL-MANAGEMENT-1]] level.
See [[#permissions-policy-integration]]. As such, |sameOriginWithAncestors| is unused.

</dl>

NOTE: The {{CredentialRequestOptions/mediation}} flag is currently not used.
Expand All @@ -1077,11 +1082,6 @@ requests.
<dfn for="IdentityCredential" method>\[[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)</dfn>\
algorithm is invoked, the user agent MUST execute the following steps:

1. If <var ignore>sameOriginWithAncestors</var> is `false`, throw a
"{{NotAllowedError}}" {{DOMException}}.

Note: This restriction aims to address the concern raised
in [[Security-Origin-Confusion]].
1. Assert: |options|["{{CredentialRequestOptions/identity}}"]["{{IdentityCredentialRequestOptions/providers}}"] [=map/exists=].
1. Assert: |options|["{{CredentialRequestOptions/identity}}"]["{{IdentityCredentialRequestOptions/providers}}"] [=list/size=] is 1.

Expand Down Expand Up @@ -1359,6 +1359,27 @@ steps:

Note: go over how we are planning to deal with backwards compatibility.

<!-- ============================================================ -->
# Permissions Policy Integration # {#permissions-policy-integration}
<!-- ============================================================ -->

FedCM defines a [=policy-controlled feature=] identified by the string `"fedcm"`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use a different name, not fedcm. How about identity-credential (or the plural, not sure what is better in this case)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm so for publickey (which is the closest to this, I guess) we have publickey-credentials-get, which might make sense as it describes the capability that we're exposing, so identity-credential-get? It sounds a bit funky though.

@clelland do you have any thoughts/advice on naming for PP?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ping

Copy link
Collaborator

Choose a reason for hiding this comment

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

identity-credential-get for consistency with the publickey SGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, let's agree on that, then!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we do the plural identity-credentials-get to be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I agree, it's also more consistent with the API call (credentials.get) thanks for catching that! I can update this later, as I was going to make it linkable as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@samuelgoto @npm1 assuming no concerns with this but lmk otherwise

Copy link
Collaborator

Choose a reason for hiding this comment

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

No concern from my end

Its [=default allowlist=] is `"self"`.

A {{Document}}’s [=Document/permissions policy=] determines whether any content
in that document is allowed to obtain a credential object using the [[#browser-api|Browser API]].
Attempting to invoke <code><a idl for="CredentialsContainer" lt="get()">navigator.credentials.get({identity:..., ...})</a></code>
in documents that are not [=allowed to use=] the `"fedcm"` feature will result
in [=a promise rejected with=] a "{{NotAllowedError}}" {{DOMException}}.

This restriction can be controlled using the mechanisms described in [[PERMISSIONS-POLICY]].

Note: Algorithms specified in [[!CREDENTIAL-MANAGEMENT-1]] perform the actual
permissions policy evaluation. This is because such policy evaluation needs to
occur when there is access to the [=current settings object=]. The [=internal method=]s
modified by this specification do not have such access since they are invoked [=in parallel=]
by {{CredentialsContainer}}'s <a abstract-op>Request a `Credential`</a> abstract operation.

<!-- ============================================================ -->
# Security # {#security}
<!-- ============================================================ -->
Expand Down Expand Up @@ -1880,6 +1901,10 @@ Note: write down the Acknowledgements section.
"href": "https://openid.net/specs/openid-connect-core-1_0.html",
"title": "OIDC Connect Core"
},
"PERMISSIONS-POLICY": {
"href": "https://w3c.github.io/webappsec-permissions-policy",
"title": "Permissions Policy"
},
"PRIVACY-MODEL": {
"href": "https://github.com/michaelkleber/privacy-model",
"title": "Privacy Model"
Expand Down