Repository navigation
feat(hostkey): make tofu trust first-seen keys and add prompt shortcuts - #36
Merged
Merged
Conversation
host_key_policy: tofu only changed Accept once, so every new host still prompted. It now adds a first-seen key to known_hosts without asking and prints the fingerprint; changed keys still prompt. The new-key prompt also accepts Enter to reject, o to accept once, and a to accept always.
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.
Summary
ssh.security.host_key_policy: tofuonly switched Accept once toaccept-new; every first connection still showed the host-key prompt.tofu, a first-seen key is appended to~/.ssh/known_hostswithout prompting, and nssh prints the host and fingerprint to stderr. Changed keys still go through the existing warning prompt. This also works for captured command runs, which previously failed without an interactive prompt.o(accept once), anda(accept always). Arrow keys still work, and filtering is off so letters stay shortcuts. The changed-key prompt keeps no single-key acceptance, since a stray key there would trust a possibly hostile key.Changes
internal/connect/hostkey_prepare.go: TOFU path inrunHostKeyPreparation.internal/ui/prompts.go:SelectIndexWithShortcuts, a huh select wrapped to intercept shortcut keys.internal/connect/hostkey.go: new-key prompt labels and shortcuts.example_config.yaml.Verification
make container-testpasses.