Skip to content

sk-usbhid: preserve UV requirement for resident keys - #701

Open
savely-krasovsky wants to merge 1 commit into
openssh:masterfrom
savely-krasovsky:fix-resident-sk-uv-flags
Open

sk-usbhid: preserve UV requirement for resident keys#701
savely-krasovsky wants to merge 1 commit into
openssh:masterfrom
savely-krasovsky:fix-resident-sk-uv-flags

Conversation

@savely-krasovsky

@savely-krasovsky savely-krasovsky commented Jul 25, 2026

Copy link
Copy Markdown

What changed

Derive SSH_SK_USER_VERIFICATION_REQD directly from a resident credential's credProtect policy when loading it from an authenticator.

Why

Resident credentials created with verify-required store FIDO_CRED_PROT_UV_REQUIRED on the authenticator.

During ssh-keygen -K and ssh-add -K, read_rks() currently propagates this as SSH_SK_USER_VERIFICATION_REQD only when the authenticator does not report its uv capability. Authenticators with built-in UV therefore produce downloaded key files with flags 0x21
instead of 0x25.

The credential policy should be preserved independently of the authenticator's current UV capability. The compatibility guard ensures that builds using libfido2 versions without fido_cred_prot() retain
their existing behavior.

Validation

  • Built the portable tree with --with-security-key-builtin and
    libfido2 1.16.
  • On an authenticator with built-in UV:
    • UV_OPTIONAL_WITH_ID (0x02) downloaded with OpenSSH flags 0x21.
    • UV_REQUIRED (0x03) downloaded with OpenSSH flags 0x25.
  • Enrolled a new resident, verify-required credential and confirmed it downloaded with flags 0x25.
  • Confirmed that signing with the downloaded key still required PIN and user presence and completed successfully.

When loading resident credentials, derive SSH_SK_USER_VERIFICATION_REQD directly from the credential's credProtect policy.

The previous code only preserved the flag when the authenticator did not report the uv capability. As a result, UV_REQUIRED credentials downloaded from authenticators with built-in UV were saved with flags 0x21 instead of 0x25.

Do not make preservation of the credential policy depend on the authenticator's current UV capability. Keep compatibility with libfido2 versions without fido_cred_prot().
@savely-krasovsky
savely-krasovsky marked this pull request as ready for review July 25, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant