Querydsl filtering silently ignores nested property paths since GH-2572
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu tại QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver#filterByJacksonVisibility và kiểm tra cách jacksonPropertiesLookup và MappedJacksonProperties xử lý các khóa request. Xem lại các test hiện có cho một segment, bao phủ @JsonIgnore và việc đổi tên bằng @JsonProperty, sau đó bổ sung coverage cho các path lồng nhau như job.id và các segment lồng nhau bị ẩn. Hoàn tất có nghĩa là các path lồng nhau hiển thị được giữ nguyên, các segment đã đổi tên hoạt động, và bất kỳ segment bị ẩn nào cũng từ chối toàn bộ key mà không khôi phục lại kết quả không lọc một cách im lặng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Java
- Star
- 957
- Fork
- 570
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của spring-projects/spring-data-rest
-
Release 5.0.9 (2025.1.9)Đang mởtype: task
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
spring-projects/spring-data-rest#2624 ·
-
Release 5.1.3 (2026.0.3)Đang mởtype: task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
spring-projects/spring-data-rest#2623 ·
-
Release 5.2.0 (2026.1.0)Đang mởtype: task
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
spring-projects/spring-data-rest#2622 ·
-
Merge patch drops linkable associations of existing array elements since 4.3Có thể đã có người làm @odrotbohm đã nhận 32 ngày trước. Đang mởstatus: feedback-provided status: waiting-for-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
spring-projects/spring-data-rest#2596 · 3 bình luận · 1 người được giao ·
-
`filterByJacksonVisibility` breaks filtering on relationsCó thể làm lại được @mp911de đã nhận 95 ngày trước và không có pull request nào đang mở. Đang mởtype: bug
spring-projects/spring-data-rest#2578 · 2 bình luận · 1 người được giao ·
Tất cả issue của spring-projects/spring-data-rest
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug/错误
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
FCL-Team/FoldCraftLauncher#1982 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] micronaut-serde-oracle-jdbc-json brings a second OJDBC driver onto the runtime classpathCó thể đã có người làm @ZARAYACH đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
micronaut-projects/micronaut-serialization#1494 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 2 ngày