-
Notifications
You must be signed in to change notification settings - Fork 311
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
🐛 rbac: Issue with Conditional Access for catalog-entity Resource #2957
Comments
So, what is currently happening, is whenever you set the I assume what you are trying to do is only show catalog entities to the user if they own them and then allow them access to the plugin from the catalog entity page. This should be accomplished with the following: rbac-policy.csv (no changes here)
conditional-policies.yaml (updated the
This combination should only let the user access their catalog entities and then let them access the plugins resources from the catalog entity page. |
Thank @PatAKnight for quick review. The issue is that if we set the conditional rule for the we have similar permissions using the |
Ah, I understand what you are trying to do. Yeah, unfortunately, that is a limitation of the plugin at the moment. Those incredibly fine grain permissions that can be set up through a coded approach give a lot more flexibility versus our no code approach. At the moment, there are only a couple of things that I can think of to potentially solve your use case. The first would be to create conditional rules for your plugin. This way, you can check if they are an owner and then perform the action. This would give you the most flexibility as you can easily add more permissions and rules as your uses cases expand. Another option that I have had somewhat success with is utilizing the catalog conditional rules within another plugin. This allows you to reuse rules that have already been defined but with the drawback of needing to rely more heavily on the catalog. In this case you can then filter based on whether or not the user is an owner. I believe that this is the plugin in question. You are already filtering right before the authorize call. What you could potentially do instead is something along the lines of:
This would just rework it so that you check for any additional filters, As mentioned, when using the catalog plugin's rules, I have had somewhat success. I am able to get the filter that I am looking for. I just haven't been able to wire everything up at the moment, because I don't have a plugin that can utilize the filter. I also have not been able to confirm if the original permission framework correctly applies the old coded approach either. |
Thanks @PatAKnight for detailed instructions. I will give it a try. |
Workspace
rbac
📜 Description
I was setting up the RBAC plugin for Backstage, but it is not working as expected with one of the plugins that use catalog-entity as the resource type for permission.
Here is how the permission is declared:
Previously, we checked for access in our permission policy like this:
This worked as expected.
After migrating to the RBAC plugin, I set up the permission in
rbac-policy.csv
as follows:p, role:default/default_policy, platformsh.environment.manage, use, allow
I also added a conditional policy in
conditional-policies.yaml
:However, it always results in DENY, even when the user should have access.
👍 Expected behavior
The RBAC plugin should allow access to users who meet the
IS_ENTITY_OWNER
condition for acatalog-entity
resource.Am I missing something? Or is there another way to use
catalog-entity
resource permissions in a custom plugin?👎 Actual Behavior with Screenshots
Even when a user is the owner of the
catalog-entity
, the RBAC plugin always denies access.👟 Reproduction steps
NA
📃 Provide the context for the Bug.
Screenshot of conditional policies in db
This is what I see in the log
👀 Have you spent some time to check if this bug has been raised before?
🏢 Have you read the Code of Conduct?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: