Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11016 +/- ##
==========================================
- Coverage 0.11% 0.11% -0.01%
==========================================
Files 2208 2222 +14
Lines 118484 119221 +737
Branches 17923 18046 +123
==========================================
Hits 137 137
- Misses 118327 119064 +737
Partials 20 20
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 56 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Contributor
Jackie-Jiang
left a comment
There was a problem hiding this comment.
Please also take a look at the failed test
pinot-broker/src/main/java/org/apache/pinot/broker/api/AccessControl.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/api/AccessControl.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/RBACAuthorization.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/RBACAuthorization.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/RBACAuthorization.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/api/AccessControl.java
Outdated
Show resolved
Hide resolved
Contributor
|
Do you have a design doc that can be linked to the PR? Or add more descriptions |
zhtaoxiang
reviewed
Jul 5, 2023
pinot-core/src/main/java/org/apache/pinot/core/auth/RBACAuthUtils.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/broker/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
Outdated
Show resolved
Hide resolved
8258b8e to
ec7b94a
Compare
9d2db40 to
d18617b
Compare
… RBAC annotations (RBACAuthorization, ManualAuthorization).
…r checking authorization
…, and modified broker and controller request filters to process the annotation and pass the access checks to access control objects.
…ll possible actions
…cessControlFactory implementations
Contributor
Jackie-Jiang
left a comment
There was a problem hiding this comment.
Mostly good. Let's go over the actions again and make sure they are following some standard format so that we don't need to change them again.
...n-tests/src/main/java/org/apache/pinot/broker/api/resources/BrokerEchoWithAutoDiscovery.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/RBACAuthUtils.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
...test/java/org/apache/pinot/controller/api/extraresources/PinotDummyExtraRestletResource.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/broker/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/broker/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
…ication in controller and broker request filters
pinot-core/src/main/java/org/apache/pinot/core/auth/FineGrainedAuthUtils.java
Outdated
Show resolved
Hide resolved
...n-tests/src/main/java/org/apache/pinot/broker/api/resources/BrokerEchoWithAutoDiscovery.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/FineGrainedAuthUtils.java
Outdated
Show resolved
Hide resolved
...ller/src/main/java/org/apache/pinot/controller/api/resources/PinotControllerHealthCheck.java
Outdated
Show resolved
Hide resolved
...n/java/org/apache/pinot/controller/api/resources/PinotInstanceAssignmentRestletResource.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
Outdated
Show resolved
Hide resolved
...ller/src/main/java/org/apache/pinot/controller/api/resources/PinotSchemaRestletResource.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
Jackie-Jiang
approved these changes
Jul 25, 2023
...oller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
...va/org/apache/pinot/controller/api/resources/PinotControllerPeriodicTaskRestletResource.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
...oller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java
Outdated
Show resolved
Hide resolved
...oller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java
Outdated
Show resolved
Hide resolved
...oller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
pinot-core/src/main/java/org/apache/pinot/core/auth/Actions.java
Outdated
Show resolved
Hide resolved
s0nskar
pushed a commit
to s0nskar/pinot
that referenced
this pull request
Aug 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support for fine grain authorization in Pinot
This PR adds support for fine grain authorization for all REST APIs in Pinot.
What is fine grain authorization?
Essentially, every API access can be thought of performing some "action" on a specific resource id "targetId" of type "TargetType". Hence before executing the REST API, the implementation validates if the caller has required access to perform the action on the specific resource, and proceeds if has access, else returns 403 error.
How can it benefit Pinot users?
This framework provides ability to give access to perform one action on a specific table, or build higher level user profiles to give access to a set of actions. For instance, one user (or group or users) can be configured to execute SQL queries only, and other user can be allowed to perform admin actions for a specifc table. One such higher level access control in the industry is role-based access control (RBAC). RBAC restricts system access based on a person's role within an organization. Through RBAC, one can enforce granualr as well as broad policies.
Example of roles:
How is fine grain authorization implemented?
There are 3 attributes required for granular authorization check:
Action and type of the resource is known statically for an API. However, the id of the resource (table name) can be in the path or query parameters of the API, or in the payload. For example: "/tables/{tableName}/instancePartitions" API has the tableName in the path parameter, and "/sql" has the table name in JSON payload. There are two annotations used for these scenarios:
a. targetType - type of the target resource (Cluster or Table)
b. paramName - path or query parameter to use to get the id or the resource
c. action - to validate on the specific resource
Request filter grabs the details from Authorize annotation to perform the validation.
The implementation builds upon existing AccessControl interface for Broker and Controller APIs by adding two methods: