Skip to content

fix(Session): avoid password confirmation on SSO - #43942

Merged
blizzz merged 2 commits into
masterfrom
fix/43612/avoid-pwd-confirm-sso
Jun 7, 2024
Merged

fix(Session): avoid password confirmation on SSO#43942
blizzz merged 2 commits into
masterfrom
fix/43612/avoid-pwd-confirm-sso

Conversation

@blizzz

@blizzzblizzz commented Mar 1, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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

Comment threadlib/private/Authentication/Token/PublicKeyTokenProvider.php Fixed
@nickvergessen

Copy link
Copy Markdown
Member

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

@blizzz

Copy link
Copy Markdown
MemberAuthor

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
blizzzforce-pushed the fix/43612/avoid-pwd-confirm-sso branch from 6c63a57 to 9ed2917CompareMarch 4, 2024 16:25
@juliusknorr

Copy link
Copy Markdown
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
Copy Markdown
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?

@blizzzblizzzMar 5, 2024

Copy link
Copy Markdown
MemberAuthor

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
@blizzzblizzz self-assigned this Mar 15, 2024
@blizzz
blizzzforce-pushed the fix/43612/avoid-pwd-confirm-sso branch 3 times, most recently from 9c4d59e to e050f03CompareMarch 15, 2024 12:00
Comment threadlib/public/Authentication/Token/IToken.php Fixed
Comment threadlib/public/Authentication/Token/IToken.php Fixed
This was referenced Mar 18, 2024
@skjnldsvskjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@blizzzblizzz added the 2. developing Work in progress label Jun 4, 2024
@blizzz
blizzzforce-pushed the fix/43612/avoid-pwd-confirm-sso branch from 416acb9 to ab94c02CompareJune 5, 2024 10:37

@artongeartonge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good for me

blizzz added 2 commits June 5, 2024 19:01
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
blizzzforce-pushed the fix/43612/avoid-pwd-confirm-sso branch from ab94c02 to f6d6efeCompareJune 5, 2024 17:01
@blizzz

Copy link
Copy Markdown
MemberAuthor

/backport 340939e to stable29

@blizzz

Copy link
Copy Markdown
MemberAuthor

/backport 340939e to stable28

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

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

/backport 340939e to stable27

Comment threadlib/public/Authentication/Token/IToken.php
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbugfeature: authenticationpending documentationThis 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

10 participants

@blizzz@nickvergessen@juliusknorr@Keeper-of-the-Keys@ChristophWurst@joshtrichards@artonge@github-advanced-security@tobiasKaminsky@skjnldsv