-
Notifications
You must be signed in to change notification settings - Fork 248
[Bug]: Cannot filter with custom role (access forbidden...) #2115
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
Comments
When you are adding a filter to your GraphQL request, you will be subject to the permissions set for the given entity. Your example role, Note that DAB does not perform role inheritance. The entity definition in the dab-config.json must include a permission which defines the role To help us best understand your ask: please add a minimum reproducible example with:
|
Hi, the actual behavior is not consistent. if you have entity-a that only define one permission: anonymous read access. Why can you query that entity with role-a even if that role is not defined at the entity level? If you have access to the fields of that entity from role-a, why can't you filter on the fields you have access to? I'm not opposed to define role-a for all entities in our environment but everything is automated with dab cli and the cli doesn't permits to define multiple permissions by entity. Do you have any advise about how to handle this? |
Here is an example. The attributes entity below only defines the anonymous role.
this kind of query works under role-a even if attributes doesn't define any access for role-a. Is it the expected behavior?
my X-MS-CLIENT-PRINCIPAL looks like this:
and X-MS-API-ROLE = role-a. |
Uh oh!
There was an error while loading. Please reload this page.
What happened?
Hi, I have a config file that is defining a custom role (let say role-a) but I can't filter anonymous entites when that role is used. I'm receiving this error:
To reproduce the problem, you have to query the server with X-MS-API-ROLE = role-a + a principal that defines that role. You receive that error when you are filtering an anonymous entity.
When I look at the code, the authenticated role derives from anonymous and a custom role derives from authenticated role.
I think that the problem is in AuthorizationResolver near line 135 in the method AreColumnsAllowedForOperation. When a custom role is used and that role is not defined at the entity level, the method should check the role the custom role is inheriting from, authenticated in this case.
The test should looks like:
instead of
a work around could be to define the custom role in all entities but it's not possible to do that with the cli. You can only set one single permission by entity.
another work around could be to update the EntityPermissionsMap collections to include all custom roles defined in the configuration file and derive them from the authenticated role like the authenticated role is copied from the anonymous role (method SetEntityPermissionMap in AuthorizationResolver near line 357 when calling CopyOverPermissionsFromAnonymousToAuthenticatedRole).
I tried to do a pull request but I don't have a write access to the repository.
Is there any chance to find a correction for this?
Kind regards,
Lionel Schiepers.
Version
0.10.23
What database are you using?
Azure SQL
What hosting model are you using?
Local (including CLI), AppService, Static Web Apps (SWA), Container Apps
Which API approach are you accessing DAB through?
GraphQL
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: