Handle incompatibility between parameters
and unique
in TPublic
#41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses an issue where the
t_public.parameters
andt_public.unique
are incompatible by preventing the gem from raising an exception when this happens and just returningnil
as result ofTPM:KeyAttestation#key
.Why?
We discovered this issue after upgrading
tpm-key_attestation
to0.13.1
in cedarcode/webauthn-ruby#449. During this upgrade, a test failure in theWebAuthn
test suite revealed an unsupported edge case: calling thekey
method ofKeyAttestation
raises an exception whent_public.parameters
andt_public.unique
are incompatible.The exception occurs in the following code:
tpm-key_attestation/lib/tpm/t_public.rb
Lines 82 to 85 in 8ea5976
This issue went unnoticed before because
key_attestation.valid?
used to returnfalse
(because it failed to validate the signature), preventingkey_attestation.key
from being called. However, after changes to the signature validation process in #29,valid?
now returnstrue
for this scenario, which led the test to fail because thepubArea
for this scenario was set up with incompatibleparameters
andunique
attributes (because the coordinatesx
andy
are inconsistent with itscurve
).Although we haven’t encountered this scenario in real-world applications, the
WebAuthn
test suite helped uncover this validation gap.