-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29080 Validate Negotiated SASL QoP Against Requested #6601
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
anmolnar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but number of tests added seems a bit small to me. Don't we already tests for Sasl negotiation that we could extend?
Apache9
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add a test at rpc level?
| try { | ||
| SaslUtil.verifyNegotiatedQop(nullQop, nullQop); | ||
| } catch (Exception e) { | ||
| fail("Should not have thrown exception"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just let the exception be thrown? In this way we could see more detailed failure message...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| // Auth requested, got confidentality. | ||
| try { | ||
| SaslUtil.verifyNegotiatedQop(authentication, confidentality); | ||
| fail("Should have thrown exception"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use assertThrows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| if (saslServer.isComplete()) { | ||
| String qop = saslServer.getNegotiatedQop(); | ||
| useWrap = qop != null && !"auth".equalsIgnoreCase(qop); | ||
| String negotiatedQop = saslServer.getNegotiatedQop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the old code, SimpleServerRpcConnection does not call finishSaslNegotiation? Seems a bit strange...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point.
finishSaslNegotiation does the same thing, it's better to call that from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored SimpleServerRpcConnection to use finishSaslNegotiation.
|
@anmolnar @Apache9 Adding an integration test a that mocks/spies the SASL behaviour would be quite a task, and I don't really know how to go about that. If you think that it is needed, and better yet if you have some suggestions on how to write it, I can attempt to write one. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think there are SASL related rpc tests? You can check the tests under o.a.h.h.security package in hbase-server's src/test. |
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
@stoty Take a quick look at |
Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Andor Molnár <andor@apache.org> (cherry picked from commit 8a374dc)
Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Andor Molnár <andor@apache.org>
…6782) Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Andor Molnár <andor@apache.org>
…) (apache#6782) Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Andor Molnár <andor@apache.org> (cherry picked from commit 03effb9)
…) (apache#6782) Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Andor Molnár <andor@apache.org> (cherry picked from commit 03effb9)
…) (apache#6782) Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Andor Molnár <andor@apache.org>
No description provided.