Skip to content

fix(ctap2): check status code in getNextAssertion#199

Open
AlfioEmanueleFresta wants to merge 2 commits into
masterfrom
fix/ctap2-get-next-assertion-status-check
Open

fix(ctap2): check status code in getNextAssertion#199
AlfioEmanueleFresta wants to merge 2 commits into
masterfrom
fix/ctap2-get-next-assertion-status-check

Conversation

@AlfioEmanueleFresta
Copy link
Copy Markdown
Member

@AlfioEmanueleFresta AlfioEmanueleFresta commented May 10, 2026

Every other CTAP2 method already checks the status byte and surfaces non-OK as a typed CtapError; ctap2_get_next_assertion was the lone exception. Without the check, a device returning CTAP2_ERR_NOT_ALLOWED (the spec-defined error when no further assertion is available within the 30-second window) is silently masked as InvalidDeviceResponse; worse, any bytes the device puts after a non-OK status byte (per CTAP 2.2 §8 they are undefined) would be parsed as a valid assertion.

Changes

  • Add the standard match cbor_response.status_code block at the top of ctap2_get_next_assertion so non-OK status codes surface as Error::Ctap(<variant>) instead of being silently parsed.
  • Add regression tests covering status-code propagation across the broader set of CTAP2 methods (ctap2_get_info, ctap2_make_credential, ctap2_get_assertion, ctap2_get_next_assertion, ctap2_client_pin, ctap2_selection, ctap2_authenticator_config, ctap2_bio_enrollment, ctap2_credential_management) so a future contributor can't accidentally regress the pattern.

References

ctap2_get_next_assertion was the only CTAP2 method that did not match
the response's status byte before parsing data. A non-OK status (e.g.
CTAP2_ERR_NOT_ALLOWED when the 30-second window expires) was masked as
PlatformError::InvalidDeviceResponse, and undefined trailing bytes
after a non-OK status could be parsed as a valid assertion.

Add the standard status_code match block and a regression test that
asserts a non-OK status surfaces the correct CtapError variant.
@AlfioEmanueleFresta AlfioEmanueleFresta force-pushed the fix/ctap2-get-next-assertion-status-check branch from e400d4b to 9f194fe Compare May 12, 2026 18:38
@AlfioEmanueleFresta AlfioEmanueleFresta marked this pull request as ready for review May 12, 2026 18:38
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