Skip to content

Conversation

@diogoosorio
Copy link

@diogoosorio diogoosorio commented Nov 28, 2025

📜 Description

Caught this one in production in one of our apps

image

Which we could easily replicate by sending a request with a Content-Type: invalid (which is indeed an invalid mime-type). The app returns a 500 error.

💡 Motivation and Context

This shouldn't cause an exception on the filter, determining if the content-type of the body is an acceptable one should not be handled by the Sentry request filter.

💚 How did you test it?

Create a minimal app Spring Boot MVC app with a sentry.max-request-body-size property defined. Include sentry-spring-boot-starter-jakarta and send a request:

curl -X POST --header "Content-Type: invalid" --location "http://localhost:8080/demo" --data "{}"

See that a 500 error is returned. Re-run with this change and see that the request now goes through the remainder of the filter pipeline.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Member

@adinauer adinauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @diogoosorio, I've added the implementation for Spring 6 / Spring Boot 3.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SentrySpringFilter throws InvalidMimeTypeException with an invalid content-type header

2 participants