Consider nested property paths when filtering Querydsl parameters. - #2581
Open
lovrovrlec wants to merge 2 commits into
Open
Consider nested property paths when filtering Querydsl parameters.#2581lovrovrlec wants to merge 2 commits into
lovrovrlec wants to merge 2 commits into
Conversation
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>
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
force-pushed
the
issue/2579-nested-querydsl-paths
branch
from
July 28, 2026 12:18
2b7cc83 to
25fbf84
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the regression reported in #2579.
Since GH-2572,
filterByJacksonVisibilitymatches each request parameter against a flat map oftop-level Jackson field names. A nested key such as
address.streetis never a key in that map, soit is dropped and the endpoint silently degrades to
findAll— a filtered request returns every row.Nested paths are otherwise fully supported:
QuerydslPredicateBuilderresolves them viabindings.getPropertyPath(...), and they worked up to 5.0.5.This resolves parameter names segment by segment, translating each segment through its own
MappedJacksonPropertiesso@JsonPropertyrenames keep working at depth, and rejecting the wholeparameter 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:
forwardsNestedPropertyPathsToQuerydslfails before the fix (the parameter never reaches Querydsl).doesNotExposeJsonIgnoredPropertiesNestedInAssociationspasses before the fix only vacuously, andfails 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.