Skip to content

fix(DPE-3961): backport from 4.14 - #163

Merged
f2par0 merged 8 commits into
tesb/camel-4.8.1.xfrom
fdeparscau/fix/DPe-3961-2
Sep 11, 2026
Merged

f2par0 merged 8 commits into
tesb/camel-4.8.1.xfrom
fdeparscau/fix/DPe-3961-2

Conversation

@f2par0

@f2par0 f2par0 commented Sep 10, 2026

Copy link
Copy Markdown

Description

CAMEL-23373 commit 75d7991
CAMEL-23409. commit 17f8fcb
CAMEL-23321. commit 1816ae 6a82709

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

AI-assisted contributions

  • If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., Co-authored-by trailers) and the PR description identifies the AI tool used.

davsclaus and others added 8 commits September 10, 2026 16:22
apache#22639)

* CAMEL-23321: JMS deserializationFilter should be global configurable on component level. Fix test in itest.
…e by default (apache#22920)

* CAMEL-23373: camel-jms - Disable ObjectMessage by default (apache#22866)

* CAMEL-23373: camel-jms - Disable ObjectMessage by default

Java object serialization over JMS is rarely used in practice and is a
recurring source of security advisories. Disable creation and reading
of jakarta.jms.ObjectMessage by default and add a new objectMessageEnabled
option (default false) on JmsConfiguration / JmsComponent / JmsEndpoint
to opt back in.

When disabled, JmsBinding now refuses to:

- create an ObjectMessage from a Serializable body (auto-detected
  jmsMessageType=Object or explicitly set)
- create an ObjectMessage for transferExchange or transferException
- extract the body of a received ObjectMessage

Existing tests that rely on ObjectMessage have been updated to opt in.
A new JmsObjectMessageEnabledTest validates the default disabled
behavior on producer and consumer side, and JmsBindingTest covers the
unit-level checks. Documentation updated in the 4.21 upgrade guide.

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

* CAMEL-23373: Regenerate camel-jms / camel-activemq* / camel-amqp DSL builders

The componentdsl and endpointdsl builder factories for camel-jms and the
JMS-derived components (camel-activemq, camel-activemq6, camel-amqp) needed
to be regenerated to expose the new objectMessageEnabled option in the
fluent DSL. These are generated files only; no hand-written code changed.

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

---------

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

* CAMEL-23373: camel-jms - Disable ObjectMessage by default

---------

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
Co-authored-by: Claus Ibsen <claus.ibsen@gmail.com>
)

For consistency with camel-jms (CAMEL-23373), disable creation and
reading of jakarta.jms.ObjectMessage by default in camel-sjms and
add a new objectMessageEnabled option (default false) on SjmsComponent
and SjmsEndpoint to opt back in. camel-sjms2 inherits the change via
Sjms2Endpoint extends SjmsEndpoint and Sjms2Component extends
SjmsComponent.

When disabled, JmsBinding refuses to:
- create an ObjectMessage from a Serializable body (auto-detected
  jmsMessageType=Object or explicitly set)
- create an ObjectMessage for transferException
- extract the body of a received ObjectMessage

Both component- and endpoint-level options carry
security="insecure:serialization" so the Camel security policy sees
a uniform signal at both levels.

Tests: SjmsObjectMessageEnabledTest covers producer/consumer
default-disabled behavior, endpoint-level override, and
component-level override; JmsBindingObjectMessageEnabledTest
covers the transferException reply path. Documentation updated
in the 4.21 upgrade guide.

Closes apache#22945

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
…r JMS ObjectMessage handling in camel-jms and camel-sjms (apache#22604)

* CAMEL-23321: Add deserialization filtering for JMS ObjectMessage handling in camel-jms and camel-sjms

Aligns the JMS component family with the defense-in-depth pattern applied in
camel-netty (CAMEL-23297) and camel-mina (CAMEL-23319).

JmsBinding (camel-jms and camel-sjms) now resolves a deserialization filter at
construction using the same priority as the other components:
  configured value -> JVM -Djdk.serialFilter -> default "java.**;javax.**;org.apache.camel.**;!*".
After ObjectMessage.getObject(), the class of the returned payload is checked
against the filter and a SecurityException is thrown on reject. The filter is
exposed as a new endpoint option 'deserializationFilter' on JmsConfiguration
(camel-jms) and SjmsEndpoint (camel-sjms).

Note: this check runs after the JMS provider has deserialized the payload, so
the option does not, on its own, stop gadget chains that execute inside the
provider's ObjectInputStream. The javadoc makes this explicit and points users
to JVM-wide -Djdk.serialFilter and provider-specific filters for complete
coverage. camel-amqp inherits the behaviour via AMQPJmsBinding.

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

* Regen

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

* Regen

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

* CAMEL-23321: Add deserialization filtering for JMS ObjectMessage handling in camel-jms and camel-sjms

Configure deserializationFilter in CxfToJmsInOutTest and JmsToCxfInOutTest
Spring contexts to allow org.apache.cxf.** classes alongside the defaults,
so MessageContentsList payloads exchanged over JMS ObjectMessage pass the
filter introduced in CAMEL-23321.

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

* Regen

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>

---------

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@f2par0
f2par0 requested a review from a team as a code owner September 10, 2026 16:32

@andreasmattes andreasmattes 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.

LGTM

@f2par0
f2par0 merged commit 9e7ece7 into tesb/camel-4.8.1.x Sep 11, 2026
3 of 4 checks passed
@f2par0
f2par0 deleted the fdeparscau/fix/DPe-3961-2 branch September 11, 2026 12:57
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.

4 participants