Skip to content

fix: Extend password fallback to handle SSH agent authentication failures#85

Merged
inureyes merged 2 commits intomainfrom
fix/issue-84-password-fallback-agent-auth
Dec 15, 2025
Merged

fix: Extend password fallback to handle SSH agent authentication failures#85
inureyes merged 2 commits intomainfrom
fix/issue-84-password-fallback-agent-auth

Conversation

@inureyes
Copy link
Member

@inureyes inureyes commented Dec 15, 2025

Summary

  • Extended pattern matching in establish_connection function to include SSH agent related authentication errors
  • Password fallback now triggers correctly for:
    • SshError::KeyAuthFailed (existing)
    • SshError::AgentAuthenticationFailed (new)
    • SshError::AgentNoIdentities (new)
    • SshError::AgentConnectionFailed (new)
    • SshError::AgentRequestIdentitiesFailed (new)
  • Matches OpenSSH behavior for password fallback when agent authentication fails

Test plan

  • cargo check passes
  • cargo clippy -- -D warnings passes
  • cargo test passes
  • Manual testing with SSH agent authentication failure scenarios

Fixes #84

…ures

The password fallback mechanism now correctly triggers for all SSH agent
related authentication failures, not just SSH key authentication errors.

Previously, only SshError::KeyAuthFailed was matched for password fallback,
but SSH agent authentication can fail with different error types:
- AgentAuthenticationFailed (most common)
- AgentNoIdentities (agent has no keys)
- AgentConnectionFailed (agent connection error)
- AgentRequestIdentitiesFailed (identity request failed)

This change extends the pattern matching to include all these error types,
allowing password fallback to work correctly when SSH agent authentication
fails, matching OpenSSH behavior.

Fixes #84
@inureyes inureyes added type:bug Something isn't working priority:high High priority issue labels Dec 15, 2025
- Add is_auth_error_for_password_fallback() helper function for testability
- Add unit tests for all SSH authentication error types that should trigger
  password fallback (KeyAuthFailed, AgentAuthenticationFailed, AgentNoIdentities,
  AgentConnectionFailed, AgentRequestIdentitiesFailed)
- Add negative tests to verify non-auth errors don't trigger fallback
- Add integration test file (tests/password_fallback_test.rs)
- Export connection module publicly for test access
@inureyes inureyes self-assigned this Dec 15, 2025
@inureyes inureyes added the status:done Completed label Dec 15, 2025
@inureyes inureyes merged commit f1518e3 into main Dec 15, 2025
2 checks passed
@inureyes inureyes deleted the fix/issue-84-password-fallback-agent-auth branch December 15, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:high High priority issue status:done Completed type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password fallback not working in normal execution (when SSH agent auth fails)

1 participant