Repository navigation
Fix SFTPHookAsync letting a connection's known_hosts extra override an explicit constructor path - #73593
Merged
shahar1 merged 1 commit intoSep 23, 2026
Conversation
…n explicit constructor path _parse_extras() decided whether to take known_hosts from the connection's extra by comparing the already-expanded self.known_hosts against the literal, un-expanded "~/.ssh/known_hosts" default. Since __init__ always runs known_hosts through os.path.expanduser(), the two values can never be equal, so the comparison was always true: a connection-level known_hosts extra silently replaced even a path passed explicitly to the constructor. SSHHookAsync gets this right elsewhere in the same file, by expanding the default before comparing and only falling back to the extra when the constructor was left at that default. This applies the same pattern to SFTPHookAsync.
shahar1
approved these changes
Sep 23, 2026
This was referenced Sep 23, 2026
4 tasks done
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.
_parse_extras()decided whether to takeknown_hostsfrom the connection's extra by comparing the already-expandedself.known_hostsagainst the literal, un-expanded"~/.ssh/known_hosts"default. Since__init__always runsknown_hoststhroughos.path.expanduser(), the two values can never be equal, so the comparison was always true: a connection-levelknown_hostsextra silently replaced even a path passed explicitly to the constructor.SSHHookAsyncgets this right elsewhere in the same file, by expanding the default before comparing and only falling back to the extra when the constructor was left at that default. This applies the same pattern toSFTPHookAsync.closes: #73584
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Sonnet 5) following the guidelines