Skip to content

fix: Reject security-key policies the server cannot enforce - #343

Merged
inureyes merged 2 commits into
mainfrom
fix/issue-338-sk-touch-policy
Oct 22, 2026
Merged

inureyes merged 2 commits into
mainfrom
fix/issue-338-sk-touch-policy

Conversation

@inureyes

@inureyes inureyes commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

bssh-server now rejects security-key user authentication unless the first matching authorized_keys entry explicitly has no-touch-required without verify-required. russh does not expose signature UP/UV flags to the callback, so the server cannot enforce the default touch policy or user verification. Later duplicate entries cannot weaken the first matching entry’s policy. Ordinary keys retain their behavior, and rejected SK policies are logged at info level.

Both SK algorithms are covered through the actual SshHandler::auth_publickey callback, including all option combinations and duplicate/unrelated entries. Security and OpenSSH compatibility documentation explains the restriction and the pending signature-flag enforcement work.

Validation: focused handler regression tests pass; removing the policy guard makes both tests fail, and restoring it passes again. A separate mutation restoring duplicate-entry fallthrough fails the first-match regression. Formatting and library/focused-test Clippy checks pass. These policy tests need no authenticator because the rejection is based on authorized-key policy, not hardware behavior.

Closes #338

@inureyes inureyes added 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 Oct 22, 2026
Parse no-touch-required and verify-required in authorized_keys and reject matching SK user keys unless neither presence nor verification is required. russh does not expose signature flags to the authentication callback, so accepting other policies would silently bypass their requirements.

Cover both SK algorithms, ordinary keys, and per-entry policy in actual handler callback tests. Removing the guard makes both regression tests fail; restoring it passes. Document the restriction and the signature-flag enforcement follow-up.

Refs #338.
Reject immediately when the first matching authorized_keys entry requires an unsupported touch or verification policy. Continuing to a later duplicate allowed a no-touch-required entry to weaken the first entry's policy.

Update handler regressions and documentation for duplicate ordering and unrelated keys. Focused tests pass, and restoring the previous continue behavior fails the duplicate-entry regression.

Refs #338.
@inureyes
inureyes force-pushed the fix/issue-338-sk-touch-policy branch from 13f5d3a to 0d70b64 Compare October 22, 2026 14:19
@inureyes
inureyes merged commit 6cd85d5 into main Oct 22, 2026
5 checks passed
@inureyes
inureyes deleted the fix/issue-338-sk-touch-policy branch October 22, 2026 14:20
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:security Security vulnerability or fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(security): reject sk-* user keys whose touch policy bssh cannot enforce

1 participant