grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

Fix AdvancedTlsX509TrustManager to handle client side validation of socket

Open cfredri4 opened this issue 1 year ago • 2 comments

There's a missing if-statement to check SSLEngine vs socket before calling currentDelegateManager.checkClientTrusted

cfredri4 avatar Jul 03 '24 07:07 cfredri4

Please add unit tests.

kannanjgithub avatar Jul 03 '24 11:07 kannanjgithub

Please add unit tests.

There appears to be a test for this already but that test is a bit moot because it doesn't actually test much (it sets INSECURELY_SKIP_ALL_VERIFICATION). And had that test tested more things it would have failed because of the issue this PR fixes...

I just made this PR as a no-brainer fix to a problem I spotted when looking over unrelated code; I unfortunately don't have the time right now to investigate fixing the existing (moot) test. Feel free to either close the PR, or leave it open until I or someone else finds time to do that.

cfredri4 avatar Jul 03 '24 11:07 cfredri4

Please add unit tests.

There appears to be a test for this already but that test is a bit moot because it doesn't actually test much (it sets INSECURELY_SKIP_ALL_VERIFICATION). And had that test tested more things it would have failed because of the issue this PR fixes...

I just made this PR as a no-brainer fix to a problem I spotted when looking over unrelated code; I unfortunately don't have the time right now to investigate fixing the existing (moot) test. Feel free to either close the PR, or leave it open until I or someone else finds time to do that.

The test you mentioned doesn't go into that branch. We need a new one, maybe based on trustManagerBadCustomVerificationTest. I'll try to spend some time next week.

erm-g avatar Jul 11 '24 16:07 erm-g

@erm-g, are you okay with approving this and you'll make the test as a follow-up?

ejona86 avatar Jul 11 '24 16:07 ejona86

@erm-g, are you okay with approving this and you'll make the test as a follow-up?

Yeah, sure

erm-g avatar Jul 11 '24 17:07 erm-g

Please add unit tests.

Test added in https://github.com/grpc/grpc-java/pull/11385

erm-g avatar Jul 16 '24 04:07 erm-g