-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some fixes for interactive management #301
Conversation
msirringhaus
commented
Aug 29, 2023
- Fix typo
- Allow deserializing PublicKeyCredentialDescriptor from JSON and CBOR, instead of only CBOR.
- Automatically clear cached PUAT and try getting a new one (e.g.: when doing a few BioEnrollment-operations and then do CredentialManagement-operations).
$cached_puat = false; | ||
$skip_puap = false; | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would that happen? We should be storing permissions with the cached PinUvAuthToken
and checking them prior to sending any commands. I suppose we might still need this code to handle PUATs that have expired, so maybe only the example in the comment needs to be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually used it as the comment described. But we should indeed check the permissions before using it.
On a general note: I wanted to have this caching-mechanism as lenient as possible, to never cause non-recoverable errors. If the cached PUAT is bad for whatever reason, auth-rs should just skip it and try again to get a new one.
Hence the change in handle_errors!()
. And yes, we also need this for expired ones. But also for "bad" ones, since they are externally provided (all zeros for example, or just a random byte-array).
…rprint with a name provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just make the one change I mention below.
src/ctap2/mod.rs
Outdated
match puat_result { | ||
Some(PinUvAuthResult::SuccessGetPinToken(t)) | ||
| Some(PinUvAuthResult::SuccessGetPinUvAuthTokenUsingUvWithPermissions(t)) | ||
| Some(PinUvAuthResult::SuccessGetPinUvAuthTokenUsingPinWithPermissions(t)) => { | ||
| Some(PinUvAuthResult::SuccessGetPinUvAuthTokenUsingPinWithPermissions(t)) | ||
if t.permissions == PinUvAuthTokenPermission::BioEnrollment => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to check membership rather than equality. Looks like the version of bitflags that we're using has a contains
function.
(aside: I'm a little concerned that more recent versions of bitflags are quite different. Long term we should remove that dependency. It's not really doing much for us.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done.
We also need to think about adding a rust-toolchain.toml
-file to the repo, to avoid clippy randomly breaking the CI.
From what I can tell, this time it was a clippy-bug and not a real problem.
86daaf8
to
932369f
Compare
932369f
to
51c1afc
Compare
Thanks! |