fix(ssh): stop the askpass helper answering security-key prompts with a passphrase - #127
Merged
Merged
Conversation
… a passphrase Pebble sets SSH_ASKPASS_REQUIRE=force so an unattended probe can answer a key passphrase without a TTY. That setting routes *every* OpenSSH prompt through the helper, and the helper printed PEBBLE_SSH_ASKPASS_SECRET unconditionally — it never looked at argv[1], where OpenSSH puts the prompt text. So a FIDO2 target asked "Enter PIN for ED25519-SK key ..." received the cached passphrase. The wrong secret goes to a different authenticator, the attempt is burnt, and the user sees a passphrase error rather than a request to touch the key. Keyboard-interactive challenges such as "One-time password:" were answered the same way. Classify the prompt and release the credential only for a passphrase or account-password prompt, exiting non-zero otherwise. Exiting zero with no output would instead offer OpenSSH an empty password. The distinction is on the wording, not the key type: "Enter PIN for ED25519-SK key" is the FIDO2 PIN, while "Enter passphrase for ED25519-SK key" decrypts the local key file and the cached credential is the correct answer for it. Host-key prompts are unaffected — both call sites already set StrictHostKeyChecking=accept-new, so the authenticity question never reaches askpass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
TsekaLuk
force-pushed
the
fix/ssh-askpass-prompt-kind-80
branch
from
August 10, 2026 02:44
ae4f5bb to
e771138
Compare
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.
Part of #80 (FIDO2/OpenSSH transport gating).
The bug
Pebble sets
SSH_ASKPASS_REQUIRE=force(ssh_agent_hook_bootstrap.go:203) so an unattended probe can answer a key passphrase without a TTY. That setting routes every OpenSSH prompt through the helper — and the helper printed the secret unconditionally:It never looked at
os.Args[1], which is where OpenSSH puts the prompt text.So a FIDO2 target asked
Enter PIN for ED25519-SK key ...received the cached passphrase. The wrong secret goes to a different authenticator, the attempt is burnt, and the user sees a passphrase error instead of a request to touch the key. Keyboard-interactive challenges (One-time password:,Verification code:) were answered the same way.This branch of
main.gohad no test coverage at all — the existing askpass test readsPEBBLE_SSH_ASKPASS_SECRETfrom the environment inside a fakesshscript and never invokes the helper.The fix
Classify the prompt; release the credential only for a passphrase or account-password prompt, and exit non-zero otherwise. Exiting zero with no output would instead offer OpenSSH an empty password.
The distinction is drawn on the wording, not the key type, which is the part that is easy to get wrong:
Enter passphrase for ED25519-SK key ...Enter PIN for ED25519-SK key ...Confirm user presence for key ...pebble@host's password:One-time password:Unrecognised prompts fail closed.
Host-key prompts are unaffected: both call sites already set
StrictHostKeyChecking=accept-new(ssh_agent_hook_bootstrap.go:157,ssh_text_generation_relay.go:305), so the authenticity question never reaches askpass. I checked this before changing anything, since failing closed there would have broken first contact with a new host.Verification
go test ./... -racegreen, matching the baseline onmain.Note on scope
This is one of the defects behind #80, not the whole issue. #80 also wants a capability probe (
ssh -Q keyforsk-*support) so FIDO2 is only offered when the local OpenSSH supports it, and actionable install guidance behind the eight baresystem ssh binary not founderrors. Those are separate changes.🤖 Generated with Claude Code