Skip to content

fix(login-flow-v2): validate session user and clarify flow handling#59429

Draft
joshtrichards wants to merge 8 commits intomasterfrom
jtr/refactor-LoginFlowService
Draft

fix(login-flow-v2): validate session user and clarify flow handling#59429
joshtrichards wants to merge 8 commits intomasterfrom
jtr/refactor-LoginFlowService

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

@joshtrichards joshtrichards commented Apr 3, 2026

  • Resolves: #

Summary

Clean up LoginFlowV2Service to make the Login Flow v2 exchange easier to follow and safer to maintain.

What changed

  • replaced vague variable names with flow- and crypto-specific names
  • added clearer class/method documentation for poll token and key handling
  • clarified the decryption steps and failure messages in poll()
  • renamed OpenSSL temporaries for readability
  • added a guard in flowDone() to ensure the session token user matches the provided user ID

No intended behavior changes beyond rejecting flowDone() when the session token user does not match the provided user ID. This is intended as defense in depth; existing controller code paths already provide the expected user ID.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

… service

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
… clarity

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
…nstant

100% equivalent


Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added feature: authentication technical debt 🧱 🤔🚀 ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Apr 3, 2026
@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Apr 3, 2026
Mostly just to accommodate internal exception string changes
One new test for the new defense-in-depth UID check

Signed-off-by: Josh <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: authentication ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant