Skip to content

fix: close host key fail-open paths - #259

Merged
inureyes merged 1 commit into
mainfrom
fix/issue-242-host-key-fail-closed
Aug 3, 2026
Merged

fix: close host key fail-open paths#259
inureyes merged 1 commit into
mainfrom
fix/issue-242-host-key-fail-closed

Conversation

@inureyes

@inureyes inureyes commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

Close the remaining accept-new host key verification fail-open paths by keeping process-local pins when persistent trust state is unavailable, failing closed for unusable known_hosts files, and serializing file-backed TOFU updates with an advisory lock.

What changed

  • Added AcceptNewInMemory so the default accept-new mode no longer falls back to unconditional NoCheck when no default known_hosts path can be determined.
  • Added known_hosts path probing, process-lifetime pins for newly accepted keys, and a sibling advisory lock file around the accept-new check-then-record critical section.
  • Made unsupported @cert-authority lines configurable with BSSH_CERT_AUTHORITY_POLICY=reject while preserving the existing warn-and-TOFU default.
  • Updated CLI help and docs/architecture/ssh-client.md to state the actual host key guarantees.

Test plan

  • CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo test --lib ssh::tokio_client::host_verification
  • CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo check --lib --tests
  • CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo clippy --lib --tests -- -D warnings

Closes #242

Keep accept-new from degrading to unchecked verification when no default known_hosts path can be determined by adding process-lifetime host key pinning.

Fail closed when an existing known_hosts path is unreadable or not a regular file, protect check-then-record with an advisory lock file, and make unsupported @cert-authority handling configurable with a reject policy.

Validation: CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo test --lib ssh::tokio_client::host_verification; CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo check --lib --tests; CARGO_TARGET_DIR=/home/inureyes/Development/backend.ai/bssh/target cargo clippy --lib --tests -- -D warnings.

Closes #242
@inureyes inureyes added type:bug Something isn't working priority:high High priority issue type:security Security vulnerability or fix status:review Under review status:done Completed and removed status:review Under review labels Aug 3, 2026
@inureyes
inureyes merged commit 109a4f2 into main Aug 3, 2026
3 checks passed
@inureyes
inureyes deleted the fix/issue-242-host-key-fail-closed branch August 3, 2026 10:27
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 type:security Security vulnerability or fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(security): close remaining fail-open paths in host key verification

1 participant