fix: reject proof signed with non-attested key - #504
Conversation
|
Found this subtle issue when working on key attestations for a wallet implementation. The generic error message threw me off, but with this change it should be clearer when the proof validation fails in this exact way. Really fantastic job on the project by the way! It has been extremely useful for our internal testing and development here at DIGG. |
|
Dear @asserh Thank you for reporting this and for filling the PR. PS : I also want to thank you for your kind and supportive words. I am really happy to hear that you find it useful. |
babisRoutis
left a comment
There was a problem hiding this comment.
Just a minor comment to consider
In any case, it looks good.
|
@asserh Thanks for the PR, good catch :D |
|
Absolutely, I will move it over to WalletApiTest instead 👍 Did not even notice there already were existing methods for generating attestations. Will get back to you with an update |
5a01604 to
a799412
Compare
|
Thanks for the suggestion, it made a lot of sense to relocate the test. It was a lot easier there with the existing utility functions. Does this look better? Let me know if you prefer me to squash my commits manually. Although it looks like you already use squash and merge in Github for PR:s. |
Calling `Flow.first()` caused a NoSuchElementException when no matching attested key was found, resulting in a generic error message. Use `firstOrNull()` and return an explicit InvalidProof instead. Signed-off-by: Asser Hakala <extern.asser.hakala@digg.se>
Revert changes in ValidateJwtProofTest since test is relocated Signed-off-by: Asser Hakala <extern.asser.hakala@digg.se>
a799412 to
c513522
Compare
@asserh Looks good, PR approved, will be merged in main. Thanks for the fix! |
Calling
Flow.first()caused a NoSuchElementException when no matching attested key was found, resulting in a generic error message.Use
firstOrNull()and return an explicit InvalidProof instead.