Repository navigation
Tech-debt batch 21: password reset revokes all credentials; admin create/invite after commit (#686 #692) - #699
Merged
Merged
Conversation
…invite side effects (#686, #692) A password reset left browser sessions, bearer access tokens and refresh tokens valid. on_after_reset_password now revokes them through the same revoke_all_credentials helper the password change and "sign out everywhere" use. Admin create/invite published UserCreated/UserInvited and sent the invite and verification email before the commit; they now go through publish_admin_event and on-commit callbacks. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
fastapi-users commits the new hash inside user_db.update and only then calls on_after_reset_password, so revoking there left a window (and, if that second write failed, a permanent state) where the new password was durable but old sessions and tokens still worked. ResetRevocationMixin revokes inside _update so both land in one commit, then evicts the cached counters once it is durable. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
… the reset (#686) Adds a regression test that a rejected reset password revokes nothing. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
POST /api/users/admin/invite let UserAlreadyExists escape as a 500 (found in QA); it now matches admin create-user. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
b26df00
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://53ccef96.simple-module-python.pages.dev |
| Branch Preview URL: | https://tech-debt-b21-users-revocati.simple-module-python.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tech-debt batch 21 (from the 2026-10-28 scan).
Closes #686
Closes #692
What changed
user_db.update, then callson_after_reset_password, so revoking in that hook would leave a window, or a permanent state if the second write failed, where the new password is durable but old credentials still work.ResetRevocationMixin(users/reset_revocation.py) revokes inside_update, so the new password and the revocation land in one commit. It then evicts the cached session counters once the commit is durable. A failed eviction is logged rather than failing the completed reset.users/credentials.py(revoke_all_credentials/revoke_credential_rows/announce_revocation).UserCreated/UserInvitedgo throughpublish_admin_event. The invite email and the request-less verification email are sent from on-commit callbacks, so a failed commit sends neither.POST /api/users/admin/invitewith an existing email returned 500 (unhandledUserAlreadyExists, found in QA). It now returns 409, like create-user.Tests
test_users_reset_credentials.py:test_users_admin_create_commit.py:Verification
make lint✓ ·make test-js✓ ·make test-py✓ (6346 passed, 39 skipped)https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4