Querydsl filtering silently ignores nested property paths since GH-2572
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia da QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver#filterByJacksonVisibility e verifica come jacksonPropertiesLookup e MappedJacksonProperties gestiscono le chiavi della richiesta. Esamina i test esistenti per segmenti singoli che coprono @JsonIgnore e i rinominamenti con @JsonProperty, quindi aggiungi la copertura per percorsi annidati come job.id e segmenti annidati nascosti. Il lavoro è completo quando i percorsi annidati visibili vengono preservati, i segmenti rinominati funzionano e qualsiasi segmento nascosto rifiuta l'intera chiave senza ripristinare il risultato silenzioso non filtrato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
spring-data-rest 5.0.6 (and the sibling GH-2572 backports on the other maintenance lines) drops every
nested query parameter, e.g. ?job.id=1, ?address.city=Paris.
The predicate ends up empty and the endpoint silently returns all rows instead of the filtered set.
Nested paths worked in 5.0.5 and are still fully supported by
QuerydslPredicateBuilder (bindings.getPropertyPath resolves dotted paths).
Cause:
QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver#filterByJacksonVisibility
looks up the entire request-parameter key in MappedJacksonProperties#fieldNameToProperty, which is
keyed by TOP-LEVEL Jackson field names only:
PersistentProperty<?> property = properties.getPersistentProperty(entry.getKey()); // "job.id"
if (property != null) { filtered.put(property.getName(), entry.getValue()); }
"job.id" is never a key, so the parameter is discarded regardless of visibility.
This affects associations that are fully exposed:
in our case the property has no @JsonIgnore and no @RestResource(exported = false),
and getPersistentProperty("job") resolves fine, while getPersistentProperty("job.id") returns null.
The two tests added in 3dc76b88 cover single-segment keys only (@JsonIgnore and @JsonProperty renames),
which is presumably why the regression went unnoticed.
Impact: silent — no 400, no warning. A multi-tenant reporting endpoint filtered by ?job.id=
returns the tenant's entire history instead of one job's rows.
Suggested fix — resolve the key segment by segment, rejecting it if ANY segment is hidden.
This keeps the GH-2572 guarantee (and extends it to nested levels) while restoring nested paths:
private @Nullable String resolvePath(Class<?> type, String key) {
StringBuilder resolved = new StringBuilder();
Class<?> currentType = type;
for (String segment : DOT.split(key)) {
MappedJacksonProperties properties = jacksonPropertiesLookup.apply(currentType);
if (properties == null) return null;
PersistentProperty<?> property = properties.getPersistentProperty(segment);
if (property == null) return null; // hidden at this level -> reject whole key
if (!resolved.isEmpty()) resolved.append(".");
resolved.append(property.getName()); // honours @JsonProperty renames per segment
currentType = property.getActualType();
}
return resolved.toString();
}
The resolver already holds jacksonPropertiesLookup as Function<Class<?>, MappedJacksonProperties>, so
no new wiring is needed. Happy to submit a PR with a nested-path test alongside the existing ones.
- Lingua principale
- Java
- Stelle
- 957
- Fork
- 570
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spring-projects/spring-data-rest
-
Release 5.0.9 (2025.1.9)Apertatype: task
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
spring-projects/spring-data-rest#2624 ·
-
Release 5.1.3 (2026.0.3)Apertatype: task
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
spring-projects/spring-data-rest#2623 ·
-
Release 5.2.0 (2026.1.0)Apertatype: task
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
spring-projects/spring-data-rest#2622 ·
-
Merge patch drops linkable associations of existing array elements since 4.3Forse già presa @odrotbohm l’ha presa 31 giorni fa. Apertastatus: feedback-provided status: waiting-for-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
spring-projects/spring-data-rest#2596 · 3 commenti · 1 assegnatario ·
-
`filterByJacksonVisibility` breaks filtering on relationsForse di nuovo libera @mp911de l’ha presa 94 giorni fa e non c’è nessuna pull request aperta. Apertatype: bug
spring-projects/spring-data-rest#2578 · 2 commenti · 1 assegnatario ·
Tutte le issue di spring-projects/spring-data-rest
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
quarkiverse/quarkus-google-cloud-services#1188 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
opendataloader-project/opendataloader-pdf#851 ·
I maintainer di solito rispondono entro 1 giorno
-
Component: Frontend Component: Web Component Type: Maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
it-at-m/refarch-templates#1944 ·
I maintainer di solito rispondono entro 2 giorni
-
3.0.0-M*: every channel stays reachable from its session's KEX listeners, so a long-lived session leaks all closed channelsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno