You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "maytasm (via GitHub)" <gi...@apache.org> on 2026/02/04 09:53:51 UTC
[PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
maytasm opened a new pull request, #18985:
URL: https://github.com/apache/druid/pull/18985
### Description
SupervisorsTable in SystemSchema (powering queries to the sys.supervisors table) was using the topic/stream of the supervisorSpec as the resourceName to authenticate against. This is wrong and is inconsistent with other APIs that uses the datasource name of the supervisor (i.e. updating supervisor spec, suspending/starting, querying, etc). This change fixes this to use the datasourceName and add test to verify that only datasourceName is use as resourceName in authentication.
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 commented on code in PR #18985:
URL: https://github.com/apache/druid/pull/18985#discussion_r2766731067
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -1097,7 +1097,7 @@ private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors(
);
Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList(
- AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource()));
+ AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getDataSource()));
Review Comment:
the java doc of orignial getSource says:
```
/**
* This API is only used for informational purposes in
* org.apache.druid.sql.calcite.schema.SystemSchema.SupervisorsTable
*
* @return source like stream or topic name
*/
String getSource();
```
Since here we' re using `getDataSource` I think we should remove the original getSource method definition. I check the code, besides the SystemSchema, there're few references in the the kafka supervisor spec, which can be replaced by calling `getIoConfig().getStream()`
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 commented on code in PR #18985:
URL: https://github.com/apache/druid/pull/18985#discussion_r2785389526
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -1097,7 +1097,7 @@ private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors(
);
Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList(
- AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource()));
+ AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getDataSource()));
Review Comment:
at least we should update the javadoc
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm commented on code in PR #18985:
URL: https://github.com/apache/druid/pull/18985#discussion_r2773075096
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -1097,7 +1097,7 @@ private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors(
);
Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList(
- AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource()));
+ AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getDataSource()));
Review Comment:
I don't think that's possible. getIoConfig is not a method of SupervisorSpec. It is only available in some (but not all) sub classes like KafkaSupervisorSpec but not CompactionSupervisorSpec. I think we still need this method
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm commented on PR #18985:
URL: https://github.com/apache/druid/pull/18985#issuecomment-3913368844
@jtuglu1 @FrankChen021 Please take a look when you can. Thanks!
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm merged PR #18985:
URL: https://github.com/apache/druid/pull/18985
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #18985:
URL: https://github.com/apache/druid/pull/18985#issuecomment-3932052159
> CI failure seems unrelated (but also failing a lot, ive retried many times)
Yeah, something seems to have gotten broken in the docker-tests.
I am trying to investigate it in #18849
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm commented on code in PR #18985:
URL: https://github.com/apache/druid/pull/18985#discussion_r2773075096
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -1097,7 +1097,7 @@ private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors(
);
Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList(
- AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource()));
+ AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getDataSource()));
Review Comment:
I don't think that's possible. getIoConfig is not a method of SupervisorSpec. It is only available in some (but not all) sub classes like KafkaSupervisorSpec but not CompactionSupervisorSpec. I think we still need this method (unless you will do a bunch of type checks for each subclass of SupervisorSpec which i think it's a good idea)
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm commented on PR #18985:
URL: https://github.com/apache/druid/pull/18985#issuecomment-3931964311
CI failure seems unrelated (but also failing a lot, ive retried many times)
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Fix resourceName used in auth check for SupervisorsTable in SystemSchema (druid)
Posted by "maytasm (via GitHub)" <gi...@apache.org>.
maytasm commented on code in PR #18985:
URL: https://github.com/apache/druid/pull/18985#discussion_r2815870979
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -1097,7 +1097,7 @@ private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors(
);
Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList(
- AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource()));
+ AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getDataSource()));
Review Comment:
Done
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org