-
Notifications
You must be signed in to change notification settings - Fork 3k
Make encoding errors of known extensions handable by the verify_fun #6459
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
Make encoding errors of known extensions handable by the verify_fun #6459
Conversation
CT Test Results 2 files 14 suites 5m 16s ⏱️ Results for commit 6e3758d. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
|
@andreasanta would this solve your problem? As a critical extension should be able to be handled by the |
|
Thank you! I think that almost solves it! I added a minor comment because I think there is an error being thrown when parsing fails. I agree that we should delegate control to There is another potential improvement we may want to tackle in a separate task, the trace from the parsing was not very clear in my opinion. Is there a way to get a better error from the |
44cdc54 to
d705f67
Compare
|
@andreasanta I adjusted the implementation as you are correct that an error will be raised. Do you have a certificate that you could contribute as a test case with an extension that will fail the decoding? As for your other question, the module |
|
@andreasanta just realized you provided one in the issue, thanks I will use that! |
Make encoding errors of known extensions handable by the verify_fun close erlang#6402
d705f67 to
6e3758d
Compare
|
@andreasanta also realized my first solution was correct an error tuple will actually be returned, so I changed the code back. |
Fantastic, thanks. Please use this for unit tests: public_key:pkix_decode_cert(
base64:decode(
<<"MIICXDCCAgKgAwIBAgIBATAKBggqhkjOPQQDAjApMRkwFwYDVQQFExBjOTY4NDI4OTMyNzUwOGRiMQwwCgYDVQQMDANURUUwHhcNMjIxMDI5MTczMTA3WhcNMjkwNDE2MjAzNDUzWjAfMR0wGwYDVQQDExRBbmRyb2lkIEtleXN0b3JlIEtleTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABFmIQDus/jIZ0cPnRCITCzUUuCjQBw8MetO6154mmTL8O/fFlGgYkZ6C8jSSntKC/lMwaZHxAgW1AGgoCrPuX5ejggEjMIIBHzALBgNVHQ8EBAMCB4AwCAYDVR0fBAEAMIIBBAYKKwYBBAHWeQIBEQSB9TCB8gIBAgoBAQIBAwoBAQQgyvsSa116xqleaXs6xA84wqpAPWFgaaTjCWBnZpHslmoEADBEv4VFQAQ+MDwxFjAUBAxjb20ud2hhdHNhcHACBA0+oAQxIgQgOYfQQ9EK769ahxCzZxQY/lfg4ZtlPJ34JVj+tf/OXUQweqEFMQMCAQKiAwIBA6MEAgIBAKUIMQYCAQYCAQSqAwIBAb+DdwIFAL+FPQgCBgGEJMweob+FPgMCAQC/hUAqMCgEIFNB5rJkaXmnDldlMAeh8xAWlCHsm92fGlZI91reAFrxAQH/CgEAv4VBBQIDAV+Qv4VCBQIDAxUYMAoGCCqGSM49BAMCA0gAMEUCIF0BwvRQipVoaz5SIhsYbIeK+FHbAjWPgOxWgQ6Juq64AiEA83ZLsK37DjZ/tZNRi271VHQqIU8mdqUIMboVUiy3DaM=">>
),
otp). |
|
Unfortunately, this sort of general discarding of decoding errors could cause problems in other places, such as CRL validation. And probably in general is better not to allow arbitrary decoding errors. We are thinking of making the solution more of a specific workaround for this specific error that will also not mess with the CRL validation. I will update the PR once we have had time to work something out. |
|
I see. But in theory, if the default |
|
Hi @IngelaAndin may I ask how is the change coming along, do you have any blockers you'd like to discuss? Thanks. |
|
@IngelaAndin Is there anything we could do to help out with to move forward with a solution? I assume the hold-up is partly because the resulting decoded Would it make sense to have (1) a function or module callback that could be optionally provided during decode so that these errors could be handled and (2) some sort of extension to the Context: we are running into a significant number of production decoding errors related to Android-based hardware-backed Key Attestation. We appreciate your help, please let me know if there's anything we could do to arrive at an agreeable solution. |
|
@potatosalad @IngelaAndin Potentially we can also keep the current behaviour by rethrowing in case a malformed exception is found. And we could control that behaviour with a flag passed as options to For instance: In any case, currently the implementation throws a Thank you both for your efforts 🙏 |
|
@IngelaAndin and I have discussed this and we think we can find a solution. We have now primarily thought about the problem when setting up a TLS connection and the certificate contains extensions of which one or some of them have an erroneous data. |
|
Replaced by #6883 |
close #6402