-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove deprecated hasDataAccess method. #13574
Changes from 4 commits
e6ca292
3d5a722
42c7b74
d0f2007
e1720e7
41114d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
public class AllowAllAccessFactory implements AccessControlFactory { | ||
private static final AccessControl ALLOW_ALL_ACCESS = new AccessControl() { | ||
@Override | ||
public boolean hasDataAccess(HttpHeaders httpHeaders, String tableName) { | ||
public boolean hasAccess(String tableName, AccessType accessType, HttpHeaders httpHeaders, String endpointUrl) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we can remove this function as the default implementation returns true? |
||
return true; | ||
} | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ | |
import org.apache.pinot.controller.api.access.AccessControlFactory; | ||
import org.apache.pinot.controller.api.access.AccessType; | ||
import org.apache.pinot.controller.helix.core.PinotHelixResourceManager; | ||
import org.apache.pinot.core.auth.Actions; | ||
import org.apache.pinot.core.auth.ManualAuthorization; | ||
import org.apache.pinot.core.query.executor.sql.SqlQueryExecutor; | ||
import org.apache.pinot.query.QueryEnvironment; | ||
|
@@ -292,7 +293,7 @@ private String getQueryResponse(String query, @Nullable SqlNode sqlNode, String | |
|
||
// Validate data access | ||
AccessControl accessControl = _accessControlFactory.create(); | ||
if (!accessControl.hasDataAccess(httpHeaders, rawTableName)) { | ||
if (!accessControl.hasAccess(rawTableName, AccessType.READ, httpHeaders, Actions.Table.DOWNLOAD_SEGMENT)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is Actions.Table.DOWNLOAD_SEGMENT is not suited for endpointUrl? If endpointUrl is not accessible, we can use null. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vvivekiyer / @soumitra-st We need some consensus on whether to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @soumitra-st Passing endpointUrl is critical to allow implementations to provide different access restrictions to different read endpoints. Hence I had suggested that we add the relevant action. All over our codebase (eg: PinotTableResstletResource), we pass the action as endpointUrl. If we feel that a better identifier is needed to identify endpointUrl, we can discuss. @abhioncbr as this is the query endpoint, the action here should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@vvivekiyer , if we pass action as endpointUrl across the board, then I am ok with that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback. I will make the change here as suggested by @vvivekiyer and for adding endpointUrl across board, I will raise another PR. Sounds good? |
||
return QueryException.ACCESS_DENIED_ERROR.toString(); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,7 +158,7 @@ public Response downloadSegment( | |
boolean hasDataAccess; | ||
try { | ||
AccessControl accessControl = _accessControlFactory.create(); | ||
hasDataAccess = accessControl.hasDataAccess(httpHeaders, tableName); | ||
hasDataAccess = accessControl.hasAccess(tableName, AccessType.READ, httpHeaders, Actions.Table.DOWNLOAD_SEGMENT); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, Actions.Table.DOWNLOAD_SEGMENT action used as endpointUrl. Shall we pass null? |
||
} catch (Exception e) { | ||
throw new ControllerApplicationException(LOGGER, | ||
"Caught exception while validating access to table: " + tableName, Response.Status.INTERNAL_SERVER_ERROR, e); | ||
|
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.
Why does this no longer default
true
? This is backwards incompatible for users of this interfaceThere 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.
Good catch. Adding it back in #14382