Fix: Restore EntityName after processing nested filter for CosmosDB #3072
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why make this change?
toOwnershipandfromOwnership), the query fails withAuthorizationCheckFailederror even though the user has proper permissions.What is this change?
When processing non-list nested object filters for CosmosDB in
GQLFilterParser.Parse(), theEntityNameproperty ofcosmosQueryStructureis mutated to the nested type name but not restored after the recursive parsing completes.This causes subsequent nested filters to use the wrong entity name for authorization checks:
toOwnership) →EntityNameset to "ToOwnership"DatabaseObject.NameandSourceAliasare restored ✓EntityNameis NOT restored ✗ (still "ToOwnership")fromOwnership) → authorization check uses wrong entity → failsThe fix adds a single line to restore
EntityNamealongside the existing restoration ofDatabaseObject.NameandSourceAlias.How was this tested?
Before fix:
{"errors":[{"message":"Access forbidden to a field referenced in the filter.","extensions":{"code":"AuthorizationCheckFailed"}}],"data":null}After fix:
{"data":{"transactions":{"items":[{"id":"31654581"},{"id":"28285539"}]}}}Sample Request(s)