Repository navigation
Reuse a masked password only for the host it was saved for - #48
Merged
Merged
Conversation
A profile sent back with its password or SSH key still masked had the stored secret restored by profile id alone, with no check that the host, port or protocol were unchanged. Pointing a saved profile at another machine and connecting sent the stored credentials there, although the API never shows them. Masked secrets are now refused for a different target; the password has to be entered again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st-check # Conflicts: # tests/test_main.py
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.
Fixes #47
What changed
check_masked_secrets_target(): when a profile comes back with its password or SSH key masked, the stored secret is reused only if the protocol, host (case-insensitive) and port (protocol default when unset) match the stored profile. OtherwisePOST /api/profilesandPOST /api/session/connectreturn 400: "The host, port or protocol changed: enter the password (or SSH key) again".Testing
pytest: 247 passed, 8 skipped. New API tests: the same host reuses the secret; a different host, IP, port or protocol is refused for connect and the store is left unchanged on save; a new host with a new password saves; host case and an explicit default port count as the same target. Six of them fail without the fix.main(Refuse to overwrite a profiles.json that can't be read #40 changed the same functions); both fixes are covered by the suite.🤖 Generated with Claude Code