Repository navigation
fix(auth): make an administrator-set password force a change at next login - #45702
Open
Dmitry-Kucher wants to merge 3 commits into
Open
Dmitry-Kucher wants to merge 3 commits into
Dmitry-Kucher wants to merge 3 commits into
Conversation
…login ENABLE_FORCE_PASSWORD_CHANGE redirects users flagged with password_must_change to their profile page until they choose a new password, but nothing in the tree ever raised that flag: set_password_must_change() has no caller, and setting on therefore enforced nothing. Raise the flag in SupersetUserApi, which backs the Users list: - pre_add: a user created by an administrator starts on a password the administrator chose. - pre_update: an administrator setting another user's password hands out a temporary one. An administrator changing their own password has chosen it, so a pending change of theirs is cleared instead, as on /api/v1/me/. Only while ENABLE_FORCE_PASSWORD_CHANGE is on, so enabling the setting later does not retroactively lock out every account an administrator ever set a password for, and only under AUTH_DB, where this is the password users sign in with. The flag is written without committing, through a new write_password_must_change() helper, so it rides the commit FAB issues right after pre_add/pre_update instead of committing a half-applied user edit early the way the @transaction-wrapped set_password_must_change() would. Co-Authored-By: AIST code-assistant https://virtuman.com
Dmitry-Kucher
requested review from
geido,
michael-s-molina,
msyavuz,
rusackas,
sadpandajoe and
villebro
as code owners
October 25, 2026 10:02
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #45702 +/- ##
===========================================
+ Coverage 65.38% 84.85% +19.46%
===========================================
Files 3080 3073 -7
Lines 209437 208108 -1329
Branches 49385 48752 -633
===========================================
+ Hits 136950 176597 +39647
+ Misses 69350 28131 -41219
- Partials 3137 3380 +243
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolve independent UPDATING.md additions by retaining both the administrator password-change note and upstream webhook/Impala proxy guidance.
sadpandajoe
reviewed
Nov 2, 2026
sadpandajoe
left a comment
Member
There was a problem hiding this comment.
LGTM but will approve once conflicts are resolved
Retain all upstream upgrade notes and place the administrator password-change note at the end of Next to reduce repeated insertion conflicts. Security unit suite: 753 passed on a fresh SQLite database. Pre-commit passed for all PR files.
Contributor
Author
|
@sadpandajoe Conflicts are resolved and the branch is updated with master. All 753 security unit tests and pre-commit checks pass locally. Ready for another look — thanks! |
This branch has not been deployed
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.
SUMMARY
ENABLE_FORCE_PASSWORD_CHANGE(#40669) redirects users flagged withpassword_must_changeto their profile page until they choose a new password. Nothing in the tree ever raises that flag, though:set_password_must_change()has no caller, and #40669 left wiring it to administrator flows as a follow-up. Turning the setting on therefore enforces nothing.This PR raises the flag in
SupersetUserApi, which backs the Users list (and, since #44626, every administrator password reset):pre_add(POST /api/v1/security/users/): a user created by an administrator starts on a password the administrator chose.pre_update(PUT /api/v1/security/users/<pk>): an administrator setting another user's password hands out a temporary one. An administrator changing their own password has chosen it, so a pending change of theirs is cleared instead, as on/api/v1/me/.Design notes:
ENABLE_FORCE_PASSWORD_CHANGEis on. Otherwise enabling the setting later would retroactively lock out every account an administrator ever set a password for.AUTH_DB. With OAuth/LDAP/remote-user auth, the password set in the Users list is not the one users sign in with, so forcing a change would only lock pre-provisioned users out.set_password_must_change()is@transaction()-wrapped, so calling it frompre_add/pre_updatewould commit the half-applied user edit before FAB's own commit. The write goes through a new non-committingwrite_password_must_change()helper instead, so it rides FAB's commit, the same wayinvalidate_sessions_for_userand the subject sync already do there.PUT /api/v1/me/, password recovery) already clear the flag, so the lifecycle closes.UPDATING.mdand theENABLE_FORCE_PASSWORD_CHANGEcomment inconfig.pyare updated.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (backend; the redirect UI already exists).
TESTING INSTRUCTIONS
Covers: admin create and admin password change raise the flag; self-edit doesn't (and clears a pending flag); non-password edit, setting off, and non-DB auth don't; and no commit is issued from
pre_update. The tests callpre_add/pre_updatedirectly with a stand-in acting user, as the neighbouringSupersetUserApitests do; there is no unit-level HTTP harness for this API.Manual: set
ENABLE_FORCE_PASSWORD_CHANGE = True. As admin, set a new password for another user from Settings → List Users → Edit. Log in as that user: you're redirected to the profile page to choose a new password, and after changing it, normal access resumes.ADDITIONAL INFORMATION
ENABLE_FORCE_PASSWORD_CHANGE(config, off by default)