Skip to content

fix: gracefully decline signing requests for security keys (sk)#326

Closed
aldoborrero wants to merge 1 commit intodoy:mainfrom
aldoborrero:fix/decline-sk-keys
Closed

fix: gracefully decline signing requests for security keys (sk)#326
aldoborrero wants to merge 1 commit intodoy:mainfrom
aldoborrero:fix/decline-sk-keys

Conversation

@aldoborrero
Copy link
Copy Markdown

Summary

  • Decline signing requests for FIDO2/security keys (ed25519-sk, ecdsa-sk) early in the SSH agent's sign handler
  • The agent cannot perform signing for these keys since they require physical hardware interaction (user presence/touch)
  • Previously, the agent would attempt to find a matching private key and fail with an unhelpful error
  • Now it checks for SkEd25519 and SkEcdsaSha2NistP256 key types and returns SSH_AGENT_FAILURE immediately

Motivation

When SSH_AUTH_SOCK points to rbw's agent (or an agent multiplexer that includes rbw), SSH connections using hardware security keys fail with "agent refused operation" instead of falling through to the hardware. This is because rbw's agent tries to handle the sign request instead of declining it, which prevents the SSH client from trying alternative signing methods.

This is the same behavior as OpenSSH's ssh-agent, which silently declines requests for key types it cannot handle.

Test plan

  • Tested with YubiKey 5 (ed25519-sk key) through ssh-agent-mux combining system ssh-agent + rbw agent
  • SSH to GitHub succeeds via the multiplexed socket (rbw declines sk signing, system agent handles it)
  • cargo check passes with no warnings

Fixes #281

🤖 Generated with Claude Code

The SSH agent cannot perform signing operations for FIDO2/security
keys (ed25519-sk, ecdsa-sk) since these require physical hardware
interaction (user presence/touch). Previously, the agent would
attempt to find a matching private key and fail with an unhelpful
error, which also caused issues with SSH agent multiplexers.

Now the agent checks for sk key types early in the sign handler and
returns SSH_AGENT_FAILURE immediately, allowing the SSH client to
fall back to another agent or direct hardware access.

Fixes doy#281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Secure key support for SSH agent id_xxx_sk

1 participant