Skip to content

Cherry-pick: enforce property restrictions and query limits for $apply and $compute (#1594) - #1596

Merged
WanjohiSammy merged 1 commit into
dev-10.xfrom
fix/dev10-apply-compute-restrictions
Jul 27, 2026
Merged

Cherry-pick: enforce property restrictions and query limits for $apply and $compute (#1594)#1596
WanjohiSammy merged 1 commit into
dev-10.xfrom
fix/dev10-apply-compute-restrictions

Conversation

@WanjohiSammy

Copy link
Copy Markdown
Member

Description

cherry picked from commit 9c1d552d6618d705ef486276a4cb2331fdc9c07d

@WanjohiSammy

Copy link
Copy Markdown
Member Author

/AzurePipelines run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@WanjohiSammy WanjohiSammy changed the title Cherry-pick to dev-10.x: enforce property restrictions and query limits for $apply and $compute (#1594) Cherry-pick: enforce property restrictions and query limits for $apply and $compute (#1594) Jul 22, 2026
@WanjohiSammy

Copy link
Copy Markdown
Member Author

/AzurePipelines run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

xuzhg
xuzhg previously approved these changes Jul 22, 2026
…ompute (#1594)

* fix(query): enforce property restrictions for $apply and $compute

$apply and top-level $compute had no content validator, so properties a service marks as not filterable ([NotFilterable]/[NonFilterable]) or configures as not selectable were enforced for $filter and $select but silently accepted when referenced through $apply=filter/groupby/aggregate/compute(...) or $compute=.... This adds an ApplyQueryValidator and gives ComputeQueryValidator real content so the same per-property restrictions are applied consistently across these options.

- Add IApplyQueryValidator and ApplyQueryValidator: route $apply=filter(...) through the existing FilterQueryValidator and walk groupby/aggregate/compute referenced properties.
- Add internal QueryNodeRestrictionValidator, a shared node walker that rejects not-filterable/not-selectable properties via EdmHelpers.IsNotFilterable/IsNotSelectable. The walker covers nested paths, function calls, any()/all() lambda bodies, single/collection navigations, complex properties, entity-set aggregates (AggregatedCollectionPropertyNode) and treats the virtual $count node (aggregate($count as ...)) as a no-op.
- Add ApplyQueryOption.Validator and Validate(...); wire into ODataQueryValidator and register in DI.
- Give ComputeQueryValidator real content for top-level $compute.
- Update public API baselines; add unit and E2E tests.

The change is a no-op unless a property is explicitly restricted; a restricted property referenced via $apply/$compute now returns 400, matching $filter and $select.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Adding a concise doc-comment noting the accepted path-context limitation

* fix(query): enforce property restrictions for $apply and $compute

Also enforce AllowedFunctions/operators and MaxNodeCount inside groupby/aggregate/compute.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f408404f-6bba-448b-8b75-5fea8aae8672

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 9c1d552)
@WanjohiSammy
WanjohiSammy force-pushed the fix/dev10-apply-compute-restrictions branch from 7b960e6 to 1c37737 Compare July 22, 2026 19:19
@WanjohiSammy
WanjohiSammy merged commit 0d3432b into dev-10.x Jul 27, 2026
1 check passed
@WanjohiSammy
WanjohiSammy deleted the fix/dev10-apply-compute-restrictions branch July 27, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants