Skip to content

[Security] - Experiment migrating to fido2 2.2.0 - #2663

Merged
whabanks merged 12 commits into
mainfrom
security/migrate-fido2-2.2.0
Apr 22, 2026
Merged

[Security] - Experiment migrating to fido2 2.2.0#2663
whabanks merged 12 commits into
mainfrom
security/migrate-fido2-2.2.0

Conversation

@whabanks

@whabanks whabanks commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary | Résumé

We need to bump cryptography in utils to patch a vulnerability. However, this also requires migrating to fido2 >= 2.2.0 in API, as fido2 transitively pulls in cryptography and 2.2.0 is the latest version that includes a patched cryptography version.

In fido2 >= 2.0.0 CBOR encoding has been dropped in favour of JSON encoding. Changing the data shape and endpoint contract between API and Admin. This PR aims to update the contract to be compatible with the API change made here.

Key changes:

  • Removed all CBOR encode/decode usage in user_api_client and user_profile
  • Switch from CBOR encode/decode to JSON and build a standard WebAuthn response in fido2.js when building registration and authentication responses.

Test instructions | Instructions pour tester la modification

  1. Run the app locally, and add a security key to your account if you are not already using one
  2. Check out this branch and the accompanying API branch
    • Make sure to run poetry install in API and npm run tailwind in admin before continuing
  3. Log into notify with an existing security key to ensure backwards compatibility
  • Login should work correctly
  1. Log out, then log back in but use a different security key, one that won't pass validation (physical vs 1pass for example)
  • Shouldn't be able to log in
  1. Log back in and remove your security key
  2. Log out and in again
  • Note you received the email code prompt as usual
  1. Finish logging in and add a security key once again
  2. Log out, log in using the new key
  • Login works

In version >=2.0.0 of fido2 CBOR encoding was dropped in favour of
JSON compatible dicts, changing the API contract between admin and api.
@github-actions

Copy link
Copy Markdown

whabanks and others added 2 commits April 20, 2026 11:07
- Enabled `WebAuthentication` in Cypress.
- Diabled `WebAuthenticationBluetooth` and `WebAuthenticationCable` to
  limit Cypress to virtual authenticators only
@whabanks
whabanks marked this pull request as ready for review April 20, 2026 16:20
- In fido2 v1 the `challenge` is contained in a `publicKey` key, in v2
  these data elements are top level, which caused them to be missed when
packaged for `navigator.credentials`. This should resolve cypress test
failures
- Updated some unit test mocks to accurately reflect new v2 JSON formats
Comment thread app/main/views/user_profile.py Fixed
whabanks and others added 2 commits April 21, 2026 16:19
Cypress tests related to security keys were failing because the API
  image built to run the tests against is from main, which does not yet
contain the code migrating from fido2 1.x.x -> 2.2.0, so the expected
responses are structured differently. These should pass once that code
is merged
@whabanks

Copy link
Copy Markdown
Contributor Author

Cypress tests will fail here until cds-snc/notification-api#2836 is merged

@whabanks
whabanks merged commit 85895ec into main Apr 22, 2026
12 of 13 checks passed
@whabanks
whabanks deleted the security/migrate-fido2-2.2.0 branch April 22, 2026 15:09
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.

3 participants