Expand description
Interactive confirmation prompts for the SSH agent daemon.
When a key was added with --confirm (SSH agent protocol’s
SSH_AGENT_CONSTRAIN_CONFIRM), the daemon must ask the user before
each sign request. OpenSSH handles this by invoking the program
named in $SSH_ASKPASS with SSH_ASKPASS_PROMPT=confirm in its
environment; that program renders a yes/no dialog and signals the
user’s choice through its exit status — 0 means approved,
anything else means denied.
This module mirrors that contract. It is the server-side companion
to try_askpass in gitway-cli/src/main.rs, which does the
client-side passphrase flow. Same security invariants apply:
SSH_ASKPASSmust be an absolute path — a relative value could be resolved viaPATHto a binary the user did not intend to run.- The file must not be world-writable on Unix — any local user
could otherwise overwrite it between the check and
execve(2)to spy on sign prompts. - Askpass invocations run with a hard timeout so a wedged dialog
cannot pin the
Sessionlock indefinitely.
The confirm entry point is fail-safe: any error (missing
askpass, security violation, spawn failure, timeout) resolves to a
denial, which the daemon then translates into AgentError::Failure
back to the client.
Functions§
- confirm
- Prompts the user to approve a sign request. Returns
truewhen the askpass program exits0,falsein every other case. - confirm_
with - Spawns
askpasswith the given prompt and returns whether it exited0. Exposed as a separate function so tests can drive the confirmation path with a known-good script without having to mutate the process environment.