Fix OpenSslCertificateException error code validation#6581
Fix OpenSslCertificateException error code validation#6581normanmaurer wants to merge 1 commit into4.1from
Conversation
|
|
||
| // Package-private for testing | ||
| static boolean isValid(int errorCode) { | ||
| return errorCode == CertificateVerifier.X509_V_OK || |
There was a problem hiding this comment.
can't use a switch here :(
| // Package-private for testing | ||
| static boolean isValid(int errorCode) { | ||
| return errorCode == CertificateVerifier.X509_V_OK || | ||
| errorCode == CertificateVerifier.X509_V_ERR_UNSPECIFIED || |
There was a problem hiding this comment.
@Scottmitch I am not sure if this should life here or if we should better move it to tcnative. WDYT ?
| errorCode == CertificateVerifier.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT || | ||
| errorCode == CertificateVerifier.X509_V_ERR_UNABLE_TO_GET_CRL || | ||
| errorCode == CertificateVerifier.X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE || | ||
| errorCode == CertificateVerifier. X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE || |
There was a problem hiding this comment.
nit: out of place a whitespace
| errorCode == CertificateVerifier.X509_V_ERR_INVALID_NON_CA || | ||
| errorCode == CertificateVerifier.X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED || | ||
| errorCode == CertificateVerifier.X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE || | ||
| errorCode == CertificateVerifier. X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED || |
There was a problem hiding this comment.
nit: out of place a whitespace
31b4871 to
75b27e9
Compare
|
@fenik17 PTAL again |
75b27e9 to
b301f9d
Compare
There was a problem hiding this comment.
in manmaster 404 for this link..
b301f9d to
98936ff
Compare
|
@normanmaurer - regarding #6581 (comment) ... it seems less likely we will miss updating the validation logic if the validation code lives in tcnative ... and there is a clear relationship between the values and the validation code. |
|
@Scottmitch yep sounds good to me as well. Let me move it to tcnative |
98936ff to
d4c38a7
Compare
|
This depends on netty/netty-tcnative#260 |
| do { | ||
| errorCode++; | ||
| assert errorCode < Integer.MAX_VALUE; | ||
| } while (CertificateVerifier.isValid(errorCode)); |
There was a problem hiding this comment.
simplify this test just like we did in tcnative.
Motivation: In OpenSslCertificateException we tried to validate the supplied error code but did not correctly account for all different valid error codes and so threw an IllegalArgumentException. Modifications: - Fix validation by updating to latest netty-tcnative and use CertificateVerifier.isValid - Add unit tests Result: Validation of error code works as expected.
|
Addressed |
d4c38a7 to
c0db3df
Compare

Motivation:
In OpenSslCertificateException we tried to validate the supplied error code but did not correctly account for all different valid error codes and so threw an IllegalArgumentException.
Modifications:
Result:
Validation of error code works as expected.