fix: Change auth from WRITE to READ for specGetAll#19272
fix: Change auth from WRITE to READ for specGetAll#19272aho135 merged 3 commits intoapache:masterfrom
Conversation
|
I've often believed that WRITE is appropriate for permissions like this, on the rationale that the ingestion APIs should only be accessible to people with ability to manipulate ingestion objects, which of course requires WRITE permission. I guess your mental model is different, one where READ permission means the user can see ingestion objects but not necessary manipulate them. I wish that the permission model was more fine grained so we could separate READ of the data from READ of the ingestion objects. I wonder, what's the current state of things? What authorization do other read-only APIs in |
Thanks for the review @gianm!
I believe @clintropolis was working on something similar to this with the addition of a Policy in the Authorizer to allow more granular control over table reads
These API's also follow the model where users can READ all ingestion objects, but manipulation still requires WRITE. For example, task submission requires write, but |
|
@gianm Please let me know your thoughts on this one when you get the chance. Thanks! |
abhishekrb19
left a comment
There was a problem hiding this comment.
These API's also follow the model where users can READ all ingestion objects, but manipulation still requires WRITE. For example, task submission requires write, but /task/{taskid}/status only requires READ. Even for system tables those only require READ access, so I think the changes in this PR at least make things consistent with the current state of things
This seems reasonable to me as the updated access model is internally consistent with the other existing GET APIs noted
| Optional<SupervisorSpec> supervisorSpecOptional = manager.getSupervisorSpec(supervisorId); | ||
| return supervisorSpecOptional | ||
| .transform(spec -> SPEC_DATASOURCE_READ_RA_GENERATOR.apply(new VersionedSupervisorSpec(spec, null))) |
There was a problem hiding this comment.
Just confirming that applying a transform directly on the optional supervisorSpecOptional won’t cause any issues without checking .isPresent(). It seems like it won’t, but I noticed this differs from the logic in filterAuthorizedSupervisorIds()
There was a problem hiding this comment.
What do you think about adding a function like filterAuthorizedSupervisorIdsForRead() to make read access explicit? So any new read-only APIs know to call this function instead of filterAuthorizedSupervisorIds()
There was a problem hiding this comment.
Thanks for the review @abhishekrb19! Yeah that was kind of a roundabout way of doing things. I made an update to filterAuthorizedSupervisorIds to pass in the Authorization function and it looks cleaner now. Lmk what you think!
|
Good call @abhishekrb19 Created #19362 for backporting! |
|
@cecemei Yeah this issue only surfaces with |
Description
The current implementation of specGetAll is unnecessarily restrictive as it uses DATASOURCE_WRITE_RA_GENERATOR for authorization. This PR changes the Authorization to only require READ. This issue was surfaced after testing out the endpoint with the Read Only Authorizer enabled. Since the history endpoint already returns the list of all Supervisors with Read access this change makes the authorization consistent across the two endpoints
Fixed the bug ...
specGetAll returns an empty list for Supervisors when read only authorization is enabled
Release note
Key changed/added classes in this PR
SupervisorResourceSupervisorResourceTestThis PR has: