-
Notifications
You must be signed in to change notification settings - Fork 286
Handle unauthorized fields in aggregation #2790
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
Conversation
|
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This change implements authorization checks for GraphQL aggregation operations to ensure users can only group by and aggregate on fields they have permission to access. When unauthorized fields are used in groupBy arguments or aggregation functions, the system now throws an appropriate authorization error.
- Added authorization validation for fields in
groupByarguments - Added authorization validation for fields in aggregation functions
- Added new error message constants for aggregation authorization failures
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| GraphQLAuthorizationHandlerTests.cs | Added integration tests for unauthorized groupBy and aggregation field access scenarios |
| SqlQueryStructure.cs | Implemented authorization checks in ProcessGroupByField and ProcessAggregations methods |
| DataApiBuilderException.cs | Added new error message constants for groupBy and aggregation authorization failures |
| mssql-commands.txt | Added test role configuration with excluded publisher_id field for aggregation tests |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
Closes #2776
Ensure authorization error thrown if fields in the groupBy argument or in the aggregation function are not allowed for the current role.
What is this change?
During groupBy argument parsing, check if the field is allowed access for current role.
During aggregation function argument parsing, check if the field is allowed access for current role
If no access, then throw authorization error
How was this tested?
Sample Request(s)
Samples from development mode (stack traces will not be show in production mode)

