duo-labs / webauthn.io

The source code for webauthn.io, a demonstration of WebAuthn.
https://webauthn.io
BSD 3-Clause "New" or "Revised" License
651 stars 120 forks source link

Can't delete passkeys #131

Closed MasterKale closed 6 months ago

MasterKale commented 6 months ago

Something broke after I deployed #130 and deleting passkeys now raises HTTP 403 errors due to "CSRF verification failed."

Screenshot 2024-03-29 at 10 28 40 AM

I don't remember changing anything about Django or its knowledge of valid CSRF origins recently so I'm surprised to see log errors like this:

Forbidden (Origin checking failed - https://webauthn.io does not match any trusted origins.): /credential/O5hlD2QUs7pT4xD8ZIyF4FZQzDc/delete

I note here in settings.py that PROD_HOST_NAME, "should include protocol"...

https://github.com/duo-labs/webauthn.io/blob/master/_app/webauthnio/settings.py#L18-L19

...yet in the production environment PROD_HOST_NAME is only the origin, without a protocol. I'm going to try and refactor things so that I can use host-less value for ALLOWED_HOSTS but a host-inclusive value for CSRF_TRUSTED_ORIGINS and see if that won't fix the problem.