Skip to content

Consider nested property paths when filtering Querydsl parameters. - #2581

Open
lovrovrlec wants to merge 2 commits into
spring-projects:mainfrom
lovrovrlec:issue/2579-nested-querydsl-paths
Open

Consider nested property paths when filtering Querydsl parameters.#2581
lovrovrlec wants to merge 2 commits into
spring-projects:mainfrom
lovrovrlec:issue/2579-nested-querydsl-paths

Conversation

@lovrovrlec

Copy link
Copy Markdown

Fixes the regression reported in #2579.

Since GH-2572, filterByJacksonVisibility matches each request parameter against a flat map of
top-level Jackson field names. A nested key such as address.street is never a key in that map, so
it is dropped and the endpoint silently degrades to findAll — a filtered request returns every row.
Nested paths are otherwise fully supported: QuerydslPredicateBuilder resolves them via
bindings.getPropertyPath(...), and they worked up to 5.0.5.

This resolves parameter names segment by segment, translating each segment through its own
MappedJacksonProperties so @JsonProperty renames keep working at depth, and rejecting the whole
parameter as soon as a segment is not exposed — extending the GH-2572 guarantee to nested paths
instead of weakening it.

Two tests, added in the first commit so the regression is visible on its own:

  • forwardsNestedPropertyPathsToQuerydsl fails before the fix (the parameter never reaches Querydsl).
  • doesNotExposeJsonIgnoredPropertiesNestedInAssociations passes before the fix only vacuously, and
    fails against a naive fix that forwards dotted keys unchecked — it pins the security property.

One deliberate decision worth your input: when a segment's owning type has no MappedJacksonProperties
(e.g. a map value), visibility cannot be established, so the parameter is rejected. This is stricter
than pre-5.0.5 behaviour, where such paths were forwarded and left to Querydsl's binding resolution to
reject. Happy to switch to forwarding them if you prefer the lenient variant.

Nested paths such as address.street are silently dropped since spring-projectsGH-2572, turning a filtered request into an unfiltered one. A second test pins the visibility guarantee to every segment of a nested path.

See spring-projectsGH-2579.

Signed-off-by: Lovro <lovro.vrlec@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 28, 2026
Request parameters were matched against a flat map of top-level Jackson field names, so nested paths such as address.street never matched and were dropped, silently turning a filtered request into an unfiltered one.

Parameter names are now resolved segment by segment, rejecting the parameter as soon as a segment does not refer to an exposed property, so hidden properties remain unreachable through associations.

Closes spring-projectsGH-2579.

Signed-off-by: Lovro <lovro.vrlec@gmail.com>
@lovrovrlec
lovrovrlec force-pushed the issue/2579-nested-querydsl-paths branch from 2b7cc83 to 25fbf84 Compare July 28, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants