You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(auth): preserve credentials during account updates - #22507
No actionable comments were generated in the recent review.
Walkthrough
Admin password changes now pass the authenticated actor ID to the service for a target check. Password login and settings updates use conditional, field-specific database updates to protect current credentials from stale writes.
Changes: Admin Password Change
Layer / File(s)
Summary
Admin password-change actor check internal/admin/handler.go, internal/admin/service.go, internal/admin/stub.go, internal/admin/change_password_test.go
The handler passes the authenticated user ID to the service. The service checks the actor-target relationship before proceeding with the password change. Community-build helpers and a test cover the community route behavior.
Both password login paths use a shared helper that updates the access token and last-login time only when the stored password matches the password used for authentication. Tests cover successful login and rejection of a stale password.
Settings updates persist only supplied fields. Password updates also match the previously loaded password hash and return a conflict if the update does not affect one row. A test checks that stale credentials are not restored.
This change protects current credentials from stale account updates and passes the acting admin's ID to the password-change service. No concrete merge-blocking problem was found. The only open point is whether the downstream enterprise build supplies the two new admin helper functions.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title uses the conventional commit form and names the main change: preserving credentials during account updates. The raw summary shows the core change is that stale account updates no longer over…
Description check
The description has one sentence stating the purpose: preventing stale account updates from restoring credentials, and providing an admin password policy hook. It lacks the template's Summary heading …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title uses the conventional commit form and names the main change: preserving credentials during account updates. The raw summary shows the core change is that stale account updates no longer overwrite stored password data, through the password-conditioned update and the settings update path. The title is specific enough for a teammate to understand the primary change. It does not mention the admin password policy hook, which the description also lists, but the title does not need to cover every detail.
Full details: Description check
Explanation
The description has one sentence stating the purpose: preventing stale account updates from restoring credentials, and providing an admin password policy hook. It lacks the template's Summary heading and does not give background context for reviewers, such as why stale updates occur or how the fix works. The raw summary also shows the change includes a new actor-target check for admin password changes, which the description does not mention. The description is brief but it states the aim, so it is mostly complete against the template.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the password path, And keeps stale tokens from the math. The fields update one by one, The login waits until checks are done. Credentials stay in their place, While carrots bounce through database space.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 4c41d2c1-e80b-42d0-b1a7-611c6cb9cc8b
Commits
Reviewing files that changed from the base of the PR and between 2c1adcf and 976aeee.
Files selected for processing: 6
internal/admin/change_password_test.go
internal/admin/handler.go
internal/admin/service.go
internal/admin/stub.go
internal/service/user.go
internal/service/user_password_login_test.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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
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.
Prevent stale account updates from restoring credentials and provide an admin password policy hook.