Repository navigation
Conversation
|
AI assisted review Verdict: approve with one fix. The change copies what Nimbus already does in checkAuthorization: the impersonation check runs before the DRPC ACL, and if no authorizer is configured it logs a warning and allows the request. nimbus.impersonation.authorizer has no default in defaults.yaml, so deployments that don’t set it see no change. It closes a real gap: a Kerberos or SASL client can present an authorization ID that differs from its authentication ID, and DRPC never checked it. Should fix Unauthenticated HTTP request with doAsUser now throws an NPE and returns a 500. This happens when no drpc.http.filter is set. Worth noting Nits An allowed impersonated execute call logs three INFO lines: one from DRPC and two from ImpersonationAuthorizer. The 12 new tests cover deny, permit, host lists, unknown address and no-authorizer, for both the Thrift context and HTTP. The one missing case is unauthenticated doAsUser from item 1. |
|
Thanks @jnioche! All points are addressed in c7bfb06:
Nits: an allowed impersonated request now logs one INFO line, and the denial names the function. Could you have another look? |
|
thanks @rzo1 Verdict: approve. The new commit addresses every point from my earlier review. One design inconsistency remains, and I'd settle it before merging. Earlier points, now fixed
Should settle
Minor |
DRPC now checks nimbus.impersonation.authorizer for requests made on behalf of another user, like Nimbus and the UI already do. The HTTP request context now carries the remote address so host lists in nimbus.impersonation.acl apply there too. Behaviour without an impersonation authorizer is unchanged.
Make SingleUserPrincipal equality null-safe so such requests are treated as impersonation, and deny them in ImpersonationAuthorizer and the UI. Check host addresses before names, reduce per-request INFO logging, name the DRPC function in denials and document reverse proxy behaviour.
DRPC now rejects a request that sets doAsUser without an authenticated user, whether or not an impersonation authorizer is configured. Update tests and docs.
d6341b0 to
73f304e
Compare
GGraziadei
left a comment
There was a problem hiding this comment.
Hi @rzo1 thanks!
Just two non-blocking points.
| } | ||
| try { | ||
| // The servlet container reports an IP address literal, so no name lookup happens here. | ||
| return InetAddress.getByName(remoteAddr); |
There was a problem hiding this comment.
Nit: the comment is true today but getByName would silently start doing a DNS lookup per request if that ever changes. Instead InetAddress.ofLiteral(remoteAddr) gives the no-lookup guarantee explicitly (it throws IllegalArgumentException for anything that is not a literal).
Verified with java doc: https://cr.openjdk.org/~prr/8357176/api/java.base/java/net/InetAddress.html#ofLiteral(java.lang.String)
| ReqContext reqContext = ReqContext.context(); | ||
|
|
||
| if (reqContext.isImpersonating()) { | ||
| String realUserName = reqContext.realPrincipal().getName(); |
There was a problem hiding this comment.
Minor, no need to block on it. This check only looks at the request context, but for needsTopoId() endpoints it runs after the getTopologyConf call to Nimbus above, which it does not need. So a request that is going to be refused with 401 anyway first costs a Thrift round trip to Nimbus and leaves a getTopologyConf line in the Nimbus access log. Moving this if block above the needsTopoId() lookup would reject such requests right away, with no Nimbus call.
DRPC now checks nimbus.impersonation.authorizer for requests made on behalf of another user, as Nimbus and the UI already do. The HTTP request context now carries the remote address, so host lists in nimbus.impersonation.acl apply there too. Behaviour without an impersonation authorizer is unchanged.
Behaviour notes:
doAsUserbut no authenticated user (nodrpc.http.filter/ui.filter) is now denied with 401 by DRPC and the UI, whether or not an impersonation authorizer is configured. Before, DRPC let it act as the named user when no impersonation authorizer was set, and the UI failed with a 500.ImpersonationAuthorizernow logs "Allowing impersonation" at DEBUG instead of INFO (Nimbus, UI and DRPC). The "attempting to impersonate" INFO line remains.nimbus.impersonation.aclmatch the proxy's address (documented in SECURITY.md).fetchRequestgets one INFO line per poll from the impersonation authorizer.