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

Fix FedCM connection status computations #526

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Fix FedCM connection status computations #526

merged 2 commits into from
Aug 16, 2024

Conversation

npm1
Copy link
Collaborator

@npm1 npm1 commented Dec 1, 2023

In Chrome implementation, we actually have two different computations:

  • To allow auto reauthn, we need an account to actually be in the browser storage. Even if approved_clients says an account is returning, we need to have observed in the browser.
  • For the purpose of showing PP/TOS, we trust the IDP. If approved_clients is present, we rely on it. Otherwise, we rely on browser storage.

Note that the previous 'compute the connection status' algorithm now takes on the PP/TOS meaning, so its definition is slightly changed.

Fixes #626


Preview | Diff

spec/index.bs Outdated
</div>

<div algorithm>
When asked whether <dfn>auto reauthentication is allowed</dfn> given an {{IdentityProviderConfig}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

"is allowed" feels a bit confusing. even if auto reauthn is "allowed" here, it may be "disallowed" later. i.e. there are other criteria for auto reauthn, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed a bit to try to avoid confusion

spec/index.bs Outdated
1. Return whether [=connected accounts set=] [=list/contains=] |triple|.
</div>

<div algorithm="compute the login state">
Copy link
Collaborator

Choose a reason for hiding this comment

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

the audience may be confused when referring to login state and login status, is it possible to choose a different name? or is it intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to the original name, this name change was a mistake.

spec/index.bs Outdated
1. Let |triple| be the result of running [=compute the connected account key=] given |provider|,
|account|, and |globalObject|.
1. If [=connected accounts set=] [=list/contains=] |triple|, return
[=compute the login state/loggedIn=].
Copy link
Collaborator

Choose a reason for hiding this comment

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

the triple being in the set shows the user has logged in before but not necessarily "logged in" at the moment (assuming "loggedIn" implies the current state like the LoginStatus API). Would something like "has(LoggedIn)Account" work?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually I see we have hasReturningAccount below so that may also be confusing.. by the way, what's the difference between hasReturningAccount and auto reauthentication is allowed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Renamed variable.

@yi-gu
Copy link
Collaborator

yi-gu commented Dec 11, 2023

LGTM.
Could you mention in the PR description that the term "connection" now has slightly different meaning?

@npm1
Copy link
Collaborator Author

npm1 commented Dec 11, 2023

Done. Ben, this PR looks scary but the actual change is fairly small and summarized in the PR description. Let me know what you think

@npm1 npm1 added the agenda+ Regular CG meeting agenda items label Jul 25, 2024
@timcappalli timcappalli self-requested a review July 30, 2024 15:41
@bvandersloot-mozilla
Copy link
Collaborator

I'm having a hard time following the state machine of the account's state, but I think this doesn't actually modify it? It just makes it so that the IDP can suppress the TOS/PP dialog with approved_clients (as well as treating the user as having "signed in" to that IDPbefore in the UI. This seems fine.

Why is this needed though? When can an IDP have a client already approved but never have used it in this browser?

@npm1
Copy link
Collaborator Author

npm1 commented Jul 31, 2024

I'm having a hard time following the state machine of the account's state, but I think this doesn't actually modify it? It just makes it so that the IDP can suppress the TOS/PP dialog with approved_clients (as well as treating the user as having "signed in" to that IDPbefore in the UI. This seems fine.

This is correct, that is the idea of this change.

Why is this needed though? When can an IDP have a client already approved but never have used it in this browser?

This is needed since the IdP may have updated the user state outside of the browser's knowledge. One example of this would be if the user logs in to the RP on another browser via the IdP account. Then the IdP considers this account to be a returning account, and while auto reauthn is not performed, things like highlighting the account and not showing PP/TOS can be done to improve the UX.

@bvandersloot-mozilla
Copy link
Collaborator

Ah, right "client" here means RP.

I continue to have reservations about the inclusion of this much IDP logic embedded in the API, but this seems like a reasonable fixup.

Copy link
Collaborator

@bvandersloot-mozilla bvandersloot-mozilla left a comment

Choose a reason for hiding this comment

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

I meant to mark this as approved- whoops.

Copy link
Collaborator

@bvandersloot-mozilla bvandersloot-mozilla left a comment

Choose a reason for hiding this comment

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

r+

@npm1 npm1 removed the agenda+ Regular CG meeting agenda items label Aug 2, 2024
@npm1 npm1 merged commit 5013145 into main Aug 16, 2024
2 checks passed
@npm1 npm1 deleted the connectionsFix branch August 16, 2024 18:02
github-actions bot added a commit that referenced this pull request Aug 16, 2024
SHA: 5013145
Reason: push, by npm1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
npm1 added a commit that referenced this pull request Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PP/TOS requirements are different from auto reauthentication
4 participants