-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fixes #24872: Rework api authorization models #5669
base: master
Are you sure you want to change the base?
Fixes #24872: Rework api authorization models #5669
Conversation
Commit modified |
16e81d3
to
7703cc9
Compare
Commit modified |
7703cc9
to
56e1117
Compare
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.
OK, seems great. I think it needs at least a third pair of eyes to match the API dispatching - cc @clarkenciel perhaps?
@@ -226,8 +226,8 @@ trait EndpointSchema { | |||
// data container name: the expected object key in answer | |||
def dataContainer: Option[String] | |||
|
|||
// any authorization that allows to access that API - by default, admin.write | |||
def authz: List[AuthorizationType] = List(AuthorizationType.Administration.Write) | |||
// any authorization that allows to access that API |
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.
Perhaps add "Nil mean special any_righs, ie admin role, is needed"
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.
I double-checked the authz in the endpoints, I found a few that could be changed/are not consistent
} | ||
case object DeleteCampaignEvent extends CampaignApi with OneParam with StartsAtVersion16 with SortIndex { | ||
val z: Int = implicitly[Line].value | ||
val description = "Delete a campaign event" | ||
val (action, path) = DELETE / "campaigns" / "events" / "{id}" | ||
val dataContainer: Option[String] = None | ||
val dataContainer: Option[String] = None | ||
val authz: List[AuthorizationType] = AuthorizationType.Configuration.Read :: Nil |
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.
DeleteCampaignEvent
here should require Write
case object ReloadGroup extends GroupApi with GeneralApi with OneParam with StartsAtVersion2 with SortIndex { | ||
val z: Int = implicitly[Line].value | ||
val description = "Update given dynamic group node list" | ||
val (action, path) = GET / "groups" / "{id}" / "reload" | ||
val authz: List[AuthorizationType] = AuthorizationType.Group.Read :: Nil | ||
} |
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.
It could change the list of nodes in the group, so is it safe with Read
instead of Write + Edit
?
case object CheckTechnique extends TechniqueApiPub with ZeroParam with StartsAtVersion16 with SortIndex { | ||
val z: Int = implicitly[Line].value | ||
val description = "Check if a techniques is valid yaml, with rudderc compilation, with various output (json ? yaml ?)" | ||
val (action, path) = POST / "techniques" / "check" | ||
val authz: List[AuthorizationType] = AuthorizationType.Technique.Write :: AuthorizationType.Technique.Edit :: Nil | ||
} |
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.
I'm not sure if it's just a check (in which case maybe it should be Read
), or it does something else behind...
I saw it being used in Elm technique editor, shouldn't we allow them to just check the yaml ?
https://issues.rudder.io/issues/24872