Jackie-Jiang commented on code in PR #20368:
URL: https://github.com/apache/pinot/pull/20368#discussion_r4677526319
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/access/BaseBasicAuthAccessControl.java:
##########
@@ -100,12 +104,20 @@ private void warnOnceAboutTableScope(P principal, String
endpointUrl) {
@Override
public final boolean hasAccess(HttpHeaders httpHeaders, TargetType
targetType, String targetId, String action) {
- // Basic auth permissions are CRUD access types, not action names.
AuthenticationFilter enforces the resolved
- // AccessType before invoking this fine-grained check, so this overload
must only prevent unauthenticated access.
- // In particular it must not require unrestricted table scope for
TargetType.CLUSTER: several table-scoped
- // endpoints declare a cluster action, and for those the filter already
resolved the table name and ran the
- // table-scoped check above. Endpoints that name no table go through the
cluster-wide check above instead.
- return getPrincipal(httpHeaders).isPresent();
+ Optional<P> principal = getPrincipal(httpHeaders);
+ if (targetType == TargetType.CLUSTER &&
Actions.Cluster.CREATE_USER.equals(action)) {
+ return
principal.filter(BaseBasicAuthAccessControl::canCreateUser).isPresent();
+ }
+ // AuthenticationFilter already checked CRUD and table scope, including
for table requests with cluster actions.
+ return principal.isPresent();
Review Comment:
[P1] Protect user metadata mutations before trusting ADMIN
The new test's FULL_USER can still call `PUT
/users/full?component=CONTROLLER&passwordChanged=true` with its existing
password and `role: ADMIN`. `UPDATE_USER` falls through this check,
`PinotAccessControlUserRestletResource.updateUserConfig` persists the supplied
role, and after the user cache refresh subsequent user creation succeeds.
An unrestricted USER with only CREATE permission can also create a valid
user ZNRecord directly through `/zk/create` under
`/<cluster>/PROPERTYSTORE/CONFIGS/USER/<name>_CONTROLLER`; that endpoint uses
`UPDATE_ZNODE`, so it also bypasses the new role check.
These mutation routes predate this PR, but leave the security fix
incomplete. Require controller-admin authorization for role changes and writes
to user metadata, and add regression coverage for these bypasses.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]