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

Fix listing metrics as non-admin without creator policy defined #1440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Callum027
Copy link
Contributor

@Callum027 Callum027 commented Feb 11, 2025

When using a minimal RBAC policy that only allows either access either to a cloud admin or a user that is part of the project a metric's resource is owned by, e.g.

"list metric": "role:admin or project_id:%(resource.project_id)s"

There is an issue where KeystoneAuthHelper.get_metric_policy_filter will reject access to the metrics because from its perspective there are no applicable policies that the user has permission under.

This patch fixes that by adding an option to get_metric_policy_filter that allows an empty policy filter to be returned if an enforcement check for resource.project_id passes. This option is set to False by default, and only enabled where necessary.

This allows the caller to use KeystoneAuthHelper.get_resource_policy_filter to add project filters to the metric query based on the resource the metric is associated with.

When using a minimal RBAC policy that only allows either access
either to a cloud admin or a user that is part of the project
a metric's resource is owned by, e.g.

```yaml
"list metric": "role:admin or project_id:%(resource.project_id)s"
```

There is an issue where `KeystoneAuthHelper.get_metric_policy_filter`
will reject access to the metrics because from its perspective
there are no applicable policies that the user has permission under.

This patch fixes that by adding an option to `get_metric_policy_filter`
that allows an empty policy filter to be returned if an enforcement
check for `resource.project_id` passes. This option is set to `False`
by default, and only enabled where necessary.

This allows the caller to use
`KeystoneAuthHelper.get_resource_policy_filter` to add project
filters to the metric query based on the resource the metric
is associated with.
@Callum027 Callum027 force-pushed the fix-list-metric-nonadmin branch from 21a8d4c to 7874f9e Compare February 11, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants