Skip to content

filterByJacksonVisibility breaks filtering on relations #2578

Open

Description

@aronbeurskens

The following commit breaks filtering on relationship. 3dc76b8

I have an entity Dossier with a @manytomany on customers:

The DossierRepository extends the QuerydslBinderCustomizer to bind on the customer property.

@RepositoryRestResource(excerptProjection = DossierExcerpt.class)
public interface DossierRepository extends JpaRepository<Dossier, Integer>, QuerydslPredicateExecutor<Dossier>, QuerydslBinderCustomizer<QDossier> {
    @RestResource
    Page<Dossier> findAll(@QuerydslPredicate Predicate predicate, Pageable pageable);

    @Override
    default void customize(QuerydslBindings bindings, QDossier dossier) {
        // Like statements on firstName and lastName
        bindings.bind(dossier.customers.any().firstName).first(StringExpression::containsIgnoreCase);
        bindings.bind(dossier.customers.any().lastName).first(StringExpression::containsIgnoreCase);
    }

Formerly I could use: /api/dossiers?customers.firstName=John
However due to the strict checking in filterByJacksonVisibility this bind doesn't work anymore

Activity

  1. mp911de commented on Jul 1, 2026

    @mp911de
    Member

    Jammer dat ik geen Nederlands versta 🙃.

    Thanks @aronbeurskens. The initial description is just about right as it stands. We would rather keep AI generated content out of the ticket, since it tends to add overhead on our side and distracts from the actual problem.

    To your initial report: The intent of filterByJacksonVisibility is to avoid exposing any surface that could be used to probe for property names. It is a hardening measure: applications should not be susceptible to someone trying various property names outside the exported model to observe how the application reacts when a model field happens to be hit.

    Let us explore how we can pass-thru intended usage of filtered properties when there is Querydsl involved defining bindings. Given we have the registered property path bindings, we should be able to leverage these.

  2. Banesword commented on Jul 14, 2026

    @Banesword

    We also ran into this updating an app to Spring Boot 4.0.7. We'd be interested if there is a way to work around this change, for the time being we're holding back on updating Spring Data in that app.

  3. self-assigned this
    on Jul 27, 2026
  4. yashdotdev13 commented on Nov 12, 2026

    @yashdotdev13

    I checked PR #2581 and noticed it already addresses this regression with nested-path handling and regression tests. Thanks for working on this! Is there any additional testing or edge case that would be helpful to investigate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions