-
Notifications
You must be signed in to change notification settings - Fork 218
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
Getting Access forbidden message when trying to use filter on graphql queries #1434
Comments
Until a couple of days ago - reverting to an older version for development, and then deploying to SWA was working fine. It seems that this change was now deployed to Azure SWA's and it broke the functionality there as well. (very sad) |
@ksdaniel we're looking into this and jumping onto this to fix the SWA integration and roll-back this change |
@ksdaniel We've rolled back the change in Static Web Apps, can you confirm if this is working for you? |
@thomasgauvin - looks good now - we are somewhat unblocked - the 0.6.13 bug is no longer visible for our requests. |
Closing the issue! |
## Why make this change? - Closes #1434, related discussion #1423 . - Changes to add support for Cosmos to check field level auth for query filter and query nested filter. - Changes to add support for Cosmos to check field level auth for mutation operation. - Note: current mutation field auth support only check one level down, will have a follow up PR to check nested field auth for mutations. ## What is this change? - Enable ```GraphQLFilterParser``` for Cosmos. - Resolve ```WILDCARD``` and parse all the columns from schema.gql - Parse ```Included``` and ```Excluded``` columns from runtime config by injecting``` AuthorizationResolver``` into the ```CosmosMutationEngine``` to make a call to check the columns. ## How was this tested? - [x] Integration Tests - [x] Unit Tests
it looks like the issue has returned in the 0.7.15 version of dab..when i run it with with the swa cli it runs with the latest version and this error is returned. when i manually start the older version the error goes away |
I can also confirm that I have the issue with 7.15 - Azure SWA's are still working - but I am genuinely worried. |
Thanks @dgcaron for notifying. we are taking a look on what's causing it. |
@dgcaron This release contains the actual fix for the field level authorization for Cosmos DB and can you provide us the configuration file that you're trying with? Is it same as above? |
We're still investigating, but as a workaround, it seems like updating the graphql property of the entities could fix the issue. So in the above config going from this: "entities": {
"Item": {
"source": "Items",
"graphql": true,
"permissions": [
... to this: "entities": {
"Item": {
"source": "Items",
"graphql": {
"type": {
"singular": "Item",
"plural": "Items"
}
},
"permissions": [ We apologize for the inconvenience. |
) ## Why make this change? - Closes #1434 - When ```graphql``` is set to true without singular type specified in runtime config file, in addition to when field auth ```include``` permission is using WILDCARD, this was giving user's access forbidden error. ## What is this change? - Reason for causing this is because ```GraphQLSingularTypeToEntityNameMap``` in ```RuntimeConfig.cs``` is not adding the entity type when there is no singular type passed in, and for WILDCARD permission check, the ```AuthorizationResolver``` is retrieving all the fields columns using the ```GraphQLSingularTypeToEntityNameMap``` keys. ## How was this tested? - [x] Integration Tests --------- Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
Hi @dgcaron, |
this looks fine to me, with my current configuration |
Thank you for your confirmation, and helping us validate! |
Discussed in #1423
Originally posted by sumchans April 7, 2023
I have been trying out the data api builder for azure cosmos db and so far was successfully able to pull data from Azure Cosmos db. The issue I am having now is, when I use filter on the queries I get "Access forbidden to a field referenced in the filter." I believe this has something to do configuring the permissions on the dab-config.json, but I am not able to get a head start so far on this.
Here is my query -
Here is the result -
Also attaching my dab-config json file -
i have tried changing the configation and types of permissions but it looks like something broken between the current build (0.6.13)
and the previous (0.35.5).
the stacktrace shows
the code is not picking up any of the permissions (not explicit, not * and not if left empty) always returning false from this line
data-api-builder/src/Service/Models/GraphQLFilterParsers.cs
Line 151 in 893f503
if i revert to previous version, the exact same definition works fine.
The text was updated successfully, but these errors were encountered: