Skip to content

Make sure MessageContextImpl respects the limit to the maximum number of attachment to be collected#3311

Open
reta wants to merge 1 commit into
apache:mainfrom
reta:message.context.impl
Open

Make sure MessageContextImpl respects the limit to the maximum number of attachment to be collected#3311
reta wants to merge 1 commit into
apache:mainfrom
reta:message.context.impl

Conversation

@reta

@reta reta commented Jul 14, 2026

Copy link
Copy Markdown
Member

Make sure MessageContextImpl respects the limit to the maximum number of attachments to be collected

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-count into the embedded multipart parsing path in MessageContextImpl and adds explicit enforcement while iterating attachments.
  • Introduces a shared DEFAULT_ATTACHMENT_MAX_COUNT constant in AttachmentDeserializer.
  • Adds new JAX-RS tests for MultipartProvider and EntityPartProvider, plus adds package-private setters in EntityPartProvider to 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.

@reta reta force-pushed the message.context.impl branch from d581a05 to bfec78d Compare July 14, 2026 00:37
@reta reta changed the title Make sure MessageContextImpl respects the limit to the maximum number of attachment headers to be collected Make sure MessageContextImpl respects the limit to the maximum number of attachment to be collected Jul 14, 2026
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.

2 participants