Skip to content

Refactor Controller concerns to not use Warden::WebAuthn::StrategyHelpers - #29

Merged
tcannonfodder merged 8 commits into
mainfrom
2023-06-23-refactor-to-use-webauthn-rack-helpers
Jun 24, 2023
Merged

tcannonfodder merged 8 commits into
mainfrom
2023-06-23-refactor-to-use-webauthn-rack-helpers

Conversation

@tcannonfodder

Copy link
Copy Markdown
Contributor

Note, this cannot be merged in until ruby-passkeys/warden-webauthn#4 is merged and a new gem version is cut

This PR prevents the bleed-through caused by including all of Warden::WebAuthn::StrategyHelpers for a small number of methods.

This resolves #28

(@Vagab I can't add you as a reviewer directly, but would like your feedback on this one as well, since it would solve our discussion: #25 (comment))

* In order to prevent a bleed-through between `warden-webauthn` and
	`devise-passkeys`, we need to use the new
	`Warden::WebAuthn::RackHelper` in order to get the `relying_party_key`
	that it defines
	* This prevents confusion & accidental over-inclusion that was caused
		by including the entire `Warden::WebAuthn::StrategyHelpers` module
* In order to prevent a bleed-through between `warden-webauthn` and
	`devise-passkeys`, we need to add error-handling inside of
	`verify_passkey_challenge` instead of including the entire
	`Warden::WebAuthn::StrategyHelpers`
	* This prevents confusion & accidental over-inclusion that was caused
		by including the entire `Warden::WebAuthn::StrategyHelpers` module
* The definitions from the README were added directly to
	`warden-webauthn`'s `Warden::WebAuthn::RackHelper`
	* see: ruby-passkeys/warden-webauthn@80d2101
* Therefore, we can remove this code and rely on the `RackHelper`
	to define the method for us

@Vagab Vagab left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cool to be requested as a reviewer, but in the meantime here goes.
One small suggestion, other than that - lgtm 🔥

Comment thread lib/devise/passkeys/controllers/passkeys_controller_concern.rb Outdated
* Moving the preamble checks that the `parsed_credential` is valid into
	its own `verify_credential_integrity` `before_action` helps keep the
	`verify_passkey_challenge` focused, since verifying the credential's
	integrity is a separate step (making sure it's not blank and is
	parseable JSON)
@tcannonfodder
tcannonfodder merged commit 9be65a3 into main Jun 24, 2023
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.

Refactor controller concerns to not use Warden::WebAuthn::StrategyHelpers

2 participants