Skip to content

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

Merged
merged 6 commits into from
May 26, 2022

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented May 25, 2022

Parameters

When setting a parameter for a scope, that underlying resource must exist. The RBAC check is to update the underlying resource.

@Emyrk Emyrk changed the title chore: Remove org_id from provisionerdaemons feat: RBAC provisionerdaemons and parameters May 25, 2022
coderd/coderd.go Outdated
Comment on lines 145 to 151
r.Route("/provisionerdaemons", func(r chi.Router) {
r.Use(
apiKeyMiddleware,
authRolesMiddleware,
)
r.Get("/", a.provisionerDaemons)
})
Copy link
Member Author

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.

Comment on lines 87 to 91
// 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
}
Copy link
Member Author

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?

Comment on lines +226 to +230
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")
Copy link
Member Author

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?

// 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) {
Copy link
Member Author

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.

@Emyrk Emyrk marked this pull request as ready for review May 25, 2022 21:13
@Emyrk Emyrk requested a review from a team as a code owner May 25, 2022 21:13
Copy link
Member

@kylecarbs kylecarbs left a 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.

@Emyrk Emyrk merged commit c04d045 into main May 26, 2022
@Emyrk Emyrk deleted the stevenmasley/rbac_provisioners branch May 26, 2022 16:20
kylecarbs pushed a commit that referenced this pull request Jun 10, 2022
* chore: Remove org_id from provisionerdaemons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants