-
Notifications
You must be signed in to change notification settings - Fork 887
feat: RBAC provisionerdaemons and parameters #1755
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
Conversation
coderd/coderd.go
Outdated
r.Route("/provisionerdaemons", func(r chi.Router) { | ||
r.Use( | ||
apiKeyMiddleware, | ||
authRolesMiddleware, | ||
) | ||
r.Get("/", a.provisionerDaemons) | ||
}) |
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.
Moved out of the org subroutes.
coderd/parameters.go
Outdated
// Should we allow reading the params of the resource if they can read the | ||
// resource? Will this leak secrets? | ||
if !api.Authorize(rw, r, rbac.ActionRead, obj) { | ||
return | ||
} |
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.
Should we allow reading the params of the resource if they can read the resource? Will this leak secrets?
case database.ParameterScopeImportJob: | ||
// This scope does not make sense from this api. | ||
// ImportJob params are created with the job, and the job id cannot | ||
// be predicted. | ||
err = xerrors.Errorf("ImportJob scope not supported") |
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 don't think this makes sense from this API. This api sets params associated with a resource, but a job is very short lived. It doesn't make sense to set this scope like this. Right?
coderd/parameters.go
Outdated
// is equivalent to updating/reading the associated resource. | ||
// This means "parameters" are not a new resource, but an extension of existing | ||
// ones. | ||
func (api *api) parameterRBACResource(rw http.ResponseWriter, r *http.Request, scope database.ParameterScope, scopeID uuid.UUID) (rbac.Objecter, bool) { |
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.
Setting params for a resource that does not exist will now 403 forbidden.
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.
Seems reasonable to me.
* chore: Remove org_id from provisionerdaemons
Parameters
When setting a parameter for a scope, that underlying resource must exist. The RBAC check is to
update
the underlying resource.