Make sure MessageContextImpl respects the limit to the maximum number of attachment to be collected#3311
Open
reta wants to merge 1 commit into
Open
Make sure MessageContextImpl respects the limit to the maximum number of attachment to be collected#3311reta wants to merge 1 commit into
reta wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure JAX-RS multipart handling respects configured limits when collecting multipart attachments, particularly through MessageContextImpl when building inbound MultipartBody instances.
Changes:
- Propagates
attachment-max-countinto the embedded multipart parsing path inMessageContextImpland adds explicit enforcement while iterating attachments. - Introduces a shared
DEFAULT_ATTACHMENT_MAX_COUNTconstant inAttachmentDeserializer. - Adds new JAX-RS tests for
MultipartProviderandEntityPartProvider, plus adds package-private setters inEntityPartProviderto support test setup.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/MultipartProviderTest.java | Adds a multipart parsing test covering ATTACHMENT_MAX_COUNT behavior for MultipartProvider. |
| rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/EntityPartProviderTest.java | Adds a multipart parsing test covering ATTACHMENT_MAX_COUNT behavior for EntityPartProvider. |
| rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/EntityPartProvider.java | Adds setters to allow injecting Providers/MessageContext in tests. |
| rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java | Propagates and enforces max attachment count during multipart body creation. |
| core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java | Adds DEFAULT_ATTACHMENT_MAX_COUNT constant and uses it when initializing attachments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… of attachments to be collected
d581a05 to
bfec78d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make sure MessageContextImpl respects the limit to the maximum number of attachments to be collected