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(Session): avoid password confirmation on SSO #43942

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Mar 1, 2024

Summary

SSO backends like SAML and OIDC tried a trick to suppress password confirmations as they are not possible by design. At least for SAML it was not reliable when existing user backends where used as user repositories.

Now we are setting a special scope with the token, and also make sure that the scope is taken over when tokens are regenerated.

The root source might be elsewhere actually… The last-password-confirm value in the session that both SAML and OIDC store should persists (otherwise, if session data was lost, the SAML user would be logged out). It might be overwritten from elswhere, though I could not find a good candidate either. Anyway, modifying that timestamp in the session was a hack from the start.

Todos

  • In PasswordConfirmationMiddleware, confirm excludedUserBackEnds can go away and remove it

Checklist

@blizzz
Copy link
Member Author

blizzz commented Mar 1, 2024

@ArtificialOwl do you think it works with GSS, there is also an IApacheBackend implemented, or would this be tricky?

@nickvergessen
Copy link
Member

The scopes are for "what to access". Bringing in the origin into it sounds like abuse?

@blizzz
Copy link
Member Author

blizzz commented Mar 1, 2024

The scopes are for "what to access". Bringing in the origin into it sounds like abuse?

You could argue that, definitely. Extending the Tokens would break API though.

@blizzz blizzz force-pushed the fix/43612/avoid-pwd-confirm-sso branch from 6c63a57 to 9ed2917 Compare March 4, 2024 16:25
@juliushaertl
Copy link
Member

The scopes are for "what to access". Bringing in the origin into it sounds like abuse?

You could also argue that this new scope allow you to access password confirmation requiring endpoints without the password.

$sessionId = $this->session->getId();
$token = $this->tokenProvider->getToken($sessionId);
$scope = $token->getScopeAsArray();
if (isset($scope['sso-based-login']) && $scope['sso-based-login'] === true) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we actually make those strings constants (also the only other scope filesystem) and put them to IToken so that we have somehow documented what is in use?

Copy link
Member Author

@blizzz blizzz Mar 5, 2024

Choose a reason for hiding this comment

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

Actually, yes, good idea. But perhaps only 29+.

This was referenced Mar 12, 2024
@blizzz blizzz self-assigned this Mar 15, 2024
@blizzz blizzz force-pushed the fix/43612/avoid-pwd-confirm-sso branch 3 times, most recently from 9c4d59e to e050f03 Compare March 15, 2024 12:00
This was referenced Mar 18, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

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

Good enough for me with nitpick

lib/private/Template/JSConfigHelper.php Outdated Show resolved Hide resolved
@blizzz blizzz added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jun 4, 2024
@blizzz blizzz force-pushed the fix/43612/avoid-pwd-confirm-sso branch from 416acb9 to ab94c02 Compare June 5, 2024 10:37
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

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

Good for me

SSO backends like SAML and OIDC tried a trick to suppress password
confirmations as they are not possible by design. At least for SAML it was
not reliable when existing user backends where used as user repositories.

Now we are setting a special scope with the token, and also make sure that
the scope is taken over when tokens are regenerated.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz force-pushed the fix/43612/avoid-pwd-confirm-sso branch from ab94c02 to f6d6efe Compare June 5, 2024 17:01
@blizzz
Copy link
Member Author

blizzz commented Jun 5, 2024

/backport 340939e to stable29

@blizzz
Copy link
Member Author

blizzz commented Jun 5, 2024

/backport 340939e to stable28

@blizzz blizzz added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 5, 2024
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Change makes sense, code is clean (even split between a fix and a refactoring) but did not test

:shipit:

@blizzz
Copy link
Member Author

blizzz commented Jun 7, 2024

/backport 340939e to stable27

@nickvergessen nickvergessen added the pending documentation This pull request needs an associated documentation update label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug feature: authentication pending documentation This pull request needs an associated documentation update
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: Can not confirm my password for administrative actions when logged in via LDAP / SAML
8 participants