It is still possible to overflow the credential ID when creating a non-discoverable credential, especially by providing a long RP ID. (The allowed maximum is 256, and the maximum credential ID length is 255.) Stripping some of the metadata was not enough to solve the problem. To improve this, I suggest the following changes:
-
Introduce a separate type for the stripped credential. Currently, we just set the stripped fields to None. This provides the potential for subtle bugs if we assume some field to be set that has been stripped. Therefore I suggest to introduce a new StrippedCredential type that only includes the relevant fields.
-
Flatten the serialized data structure. Currently, we have three nested levels: Credential → CredentialData → PublicKeyCredentialRpEntity. This adds unnecessary overhead.
-
Remove unused fields. Having a separate type for stripped credentials makes it possible to identify the fields that are never used. Currently, these are:
rp_id: String<256>
creation_time: u32
use_counter: Option<bool>
hmac_secret: Option<bool>
rp_id is obviously the most problematic one. It remains to be investigated if we really don’t need it or if this is a problem with the current implementation.
It is still possible to overflow the credential ID when creating a non-discoverable credential, especially by providing a long RP ID. (The allowed maximum is 256, and the maximum credential ID length is 255.) Stripping some of the metadata was not enough to solve the problem. To improve this, I suggest the following changes:
Introduce a separate type for the stripped credential. Currently, we just set the stripped fields to
None. This provides the potential for subtle bugs if we assume some field to be set that has been stripped. Therefore I suggest to introduce a newStrippedCredentialtype that only includes the relevant fields.Flatten the serialized data structure. Currently, we have three nested levels:
Credential→CredentialData→PublicKeyCredentialRpEntity. This adds unnecessary overhead.Remove unused fields. Having a separate type for stripped credentials makes it possible to identify the fields that are never used. Currently, these are:
rp_id: String<256>creation_time: u32use_counter: Option<bool>hmac_secret: Option<bool>rp_idis obviously the most problematic one. It remains to be investigated if we really don’t need it or if this is a problem with the current implementation.