Skip to content

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

Merged
reta merged 1 commit into
apache:mainfrom
reta:message.context.impl
Jul 17, 2026
Merged

Make sure MessageContextImpl respects the limit to the maximum number of attachment to be collected#3311
reta merged 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
@reta
reta force-pushed the message.context.impl branch from bfec78d to a6d50ba Compare July 14, 2026 20:26
@reta
reta merged commit 0607af8 into apache:main Jul 17, 2026
5 of 8 checks passed
reta added a commit that referenced this pull request Jul 18, 2026
… of attachments to be collected (#3311)

(cherry picked from commit 0607af8)
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.

3 participants