Skip to content
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

Auth: Pre-check permissions when performing bulk state update. #13155

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

markylaing
Copy link
Contributor

Previously, state updates invoked against all instances in a project were applied partially - depending on the permissions of the caller. The commit checks permissions for all instances in the project and enforces that the caller has permission to update all of them before continuing.

Partially addresses #12461 - see #12313 (comment)

Previously, state updates invoked against all instances in a project
were applied partially - depending on the permissions of the caller.
The commit checks permissions for all instances in the project and
enforces that the caller has permission to update all of them before
continuing.

Signed-off-by: Mark Laing <mark.laing@canonical.com>
@markylaing markylaing self-assigned this Mar 14, 2024
@markylaing markylaing changed the title lxd: Pre-check permissions when performing bulk state update. Auth: Pre-check permissions when performing bulk state update. Mar 14, 2024
@markylaing markylaing mentioned this pull request Mar 14, 2024
18 tasks
if !userHasPermission(entity.InstanceURL(inst.Project().Name, inst.Name())) {
return response.Forbidden(nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a better error to the Forbidden response?

Copy link
Contributor Author

@markylaing markylaing Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what the response should be as we're attempting not to make any resources discoverable...

Maybe User does not have entitlement "can_update_state" for all instances? But then they will know that there are other instances in the project 🤔

@tomponline tomponline merged commit 410725b into canonical:main Mar 15, 2024
28 checks passed
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.

3 participants