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
[BUG] - ssh_config Match tagged statement always applies #2715
I'd like to take this. Since paramiko doesn't support tag matching, Match tagged ... should never apply - but the Match handling in SSHConfig.parse() appears to treat unknown/tagged conditions as satisfied when the block precedes the Host, so its User jane overrides the later host-specific User john. My plan: reproduce with the exact three-case script from the report, trace how Match conditions are evaluated in ssh_config.py (looking at how OpenSSH's Match tagged semantics - "matches only if a tag was explicitly given by the CLI" - should map to paramiko, where no CLI tag exists, so it should always be False), and make unsupported Match conditions evaluate to never-match rather than defaulting to match. Regression test with the report's config plus a case with a supported Match condition (e.g. Match host) to confirm those still work. I'd flag whether maintainers want a UserWarning on encountering unsupported Match conditions, since silent no-op vs explicit warning is a behavior choice.
Plan reads well. I would stay silent, unless a Host was encountered with Tag foobar, because that is the other way to select a Match tagged stanza, not only via CLI. In that case, the user should be made aware that paramiko won't honour the tag — which of course might actually be the better fix of the two, i.e. implement Match tagged ;)
Activity
AtharvRG commentedon Oct 31, 2026
I'd like to take this. Since paramiko doesn't support tag matching,
Match tagged ...should never apply - but theMatchhandling inSSHConfig.parse()appears to treat unknown/taggedconditions as satisfied when the block precedes theHost, so itsUser janeoverrides the later host-specificUser john. My plan: reproduce with the exact three-case script from the report, trace howMatchconditions are evaluated inssh_config.py(looking at how OpenSSH'sMatch taggedsemantics - "matches only if a tag was explicitly given by the CLI" - should map to paramiko, where no CLI tag exists, so it should always be False), and make unsupportedMatchconditions evaluate to never-match rather than defaulting to match. Regression test with the report's config plus a case with a supportedMatchcondition (e.g.Match host) to confirm those still work. I'd flag whether maintainers want aUserWarningon encountering unsupported Match conditions, since silent no-op vs explicit warning is a behavior choice.madduck commentedon Oct 31, 2026
Plan reads well. I would stay silent, unless a
Hostwas encountered withTag foobar, because that is the other way to select aMatch taggedstanza, not only via CLI. In that case, the user should be made aware that paramiko won't honour the tag — which of course might actually be the better fix of the two, i.e. implementMatch tagged;)Parsiffall1 commentedon Nov 7, 2026
Working on a fix for this — will open a PR with a regression test covering the three-case repro from the report.