fix: persist rotated saved password and correct manager session state#10178
Open
kundansable wants to merge 1 commit into
Open
fix: persist rotated saved password and correct manager session state#10178kundansable wants to merge 1 commit into
kundansable wants to merge 1 commit into
Conversation
For a server configured to save its password, entering a rotated password at the reconnect/password-prompt dialog appeared to work for the current connection but never actually replaced the stale saved ciphertext, causing an infinite re-prompt loop on every subsequent connection (e.g. opening the Query Tool). Two gaps caused this: 1. Query Tool's "already connected" reconnect path (sqleditor.connect_server) cached the freshly entered password on the in-memory server manager only, never writing it back to the stored server record. 2. The main "Connect to Server" flow (ServerNode.connect()) only persisted a freshly entered password to the server's stored ciphertext when the current request's save_password flag was true. But the password-prompt dialog shown on a failed connect doesn't resend the server's existing save_password setting -- it only reports its own checkbox state, which defaults to unchecked -- so a server already configured to save its password never got its stale ciphertext replaced. Separately, the driver's in-memory manager.password fix was never persisted via manager.update_session(); Driver.managers is an in-process cache, so in a multi-worker deployment (e.g. OpenShift/Helm) the next request can land on a different worker, which restores the stale pre-fix manager from the session and loses the corrected password. Fix all three: persist the new password to the (owned or shared) server record from the Query Tool reconnect path when save_password is set and allowed; treat save_password as true in the main connect flow whenever the server already has it enabled, not just when the current request's flag says so; and call manager.update_session() after a successful connect that used a freshly entered password. Fixes pgadmin-org#10128
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe connection flow now preserves saved-password settings and manager session state. Query Tool connections encrypt prompted passwords, cache them in the server manager, and optionally persist them to owned or shared server records. ChangesSaved password flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
For a server configured to save its password, entering a rotated password at the reconnect/password-prompt dialog appeared to work for the current connection but never actually replaced the stale saved ciphertext, causing an infinite re-prompt loop on every subsequent connection (e.g. opening the Query Tool).
Two gaps caused this:
Query Tool's "already connected" reconnect path (sqleditor.connect_server) cached the freshly entered password on the in-memory server manager only, never writing it back to the stored server record.
The main "Connect to Server" flow (ServerNode.connect()) only persisted a freshly entered password to the server's stored ciphertext when the current request's save_password flag was true. But the password-prompt dialog shown on a failed connect doesn't resend the server's existing save_password setting -- it only reports its own checkbox state, which defaults to unchecked -- so a server already configured to save its password never got its stale ciphertext replaced. Separately, the driver's in-memory manager.password fix was never persisted via manager.update_session(); Driver.managers is an in-process cache, so in a multi-worker deployment (e.g. OpenShift/Helm) the next request can land on a different worker, which restores the stale pre-fix manager from the session and loses the corrected password.
Fix all three: persist the new password to the (owned or shared) server record from the Query Tool reconnect path when save_password is set and allowed; treat save_password as true in the main connect flow whenever the server already has it enabled, not just when the current request's flag says so; and call manager.update_session() after a successful connect that used a freshly entered password.
Fixes #10128
Summary by CodeRabbit