Skip to content

Data binding does not filter HTTP headers for constructor bindingΒ #34292

@jannikFuellgrafEnvite

Description

@jannikFuellgrafEnvite

Summary

Since upgrading to Spring Boot 3.4.1, we have observed unexpected behavior where HTTP headers with names matching @JsonProperty annotations on POJO fields are being automatically deserialized into those fields. This behavior was not present in earlier versions.


Observations

  1. Affected Behavior:

    • An HTTP request with a priority header results in deserialization into the TaskQueryFilterParameter.priorityIn field, which has the annotation @JsonProperty("priority").
    • Similarly, a planned header is deserialized into the TaskQueryFilterParameter.plannedWithin field, annotated with @JsonProperty("planned").
  2. Reproducibility:

    • This behavior occurs whenever request headers match the names used in @JsonProperty annotations on request object fields.
  3. Impact:

    • This behavior can lead to unintended data mapping, affecting applications that rely on these headers for different purposes.
  4. Analysis Results:

    • After reviewing the dependencies and updates introduced with Spring Boot 3.4.1, we were unable to identify the specific cause (e.g., a library or code change).
    • It is unclear whether this is an intentional feature or a regression.

Expected Behavior

It is unclear whether HTTP headers with names matching @JsonProperty annotations should be automatically deserialized into POJO fields. If this is the intended behavior, guidance on how to configure or disable it would be helpful.

Actual Behavior

HTTP headers with names matching @JsonProperty annotations are deserialized into the respective POJO fields, even without explicit configuration.


Questions

  1. Is this behavior an intentional change in Spring Boot 3.4.1?
  2. If so, what is its purpose, and how can it be disabled if undesired?
  3. If this is a bug, is there a planned fix or workaround?

Thank you for your time and assistance! 😊

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions