[backport camel-4.14.x] CAMEL-23321: Add deserialization filtering for JMS ObjectMessage handling in camel-jms and camel-sjms#22604
Merged
oscerd merged 5 commits intoapache:camel-4.14.xfrom Apr 14, 2026
Conversation
…ling 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>
davsclaus
approved these changes
Apr 14, 2026
…ling 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>
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.
Backport of #22598
Cherry-pick of #22598 onto
camel-4.14.x.Original PR: #22598 - CAMEL-23321: Add deserialization filtering for JMS ObjectMessage handling in camel-jms and camel-sjms
Original author: @oscerd
Target branch:
camel-4.14.xJira: https://issues.apache.org/jira/browse/CAMEL-23321
Two commits on this branch:
CAMEL-23321: Add deserialization filtering for JMS ObjectMessage handling in camel-jms and camel-sjms(cherry-picked fromc5c8d4f668c, one conflict resolved — see below)Regen— regeneratedcamel-jmscatalog on thecamel-4.14.xbaselineConflict resolution
Cherry-picking
c5c8d4f668cproduced three conflicts:components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsBinding.java— style-only:mainuses pattern-matchinginstanceof,camel-4.14.xuses explicit cast. Resolved by keeping the 4.14.x style and adding only the security-relevantcheckDeserializedClass(payload)call and// NOSONARmarker:components/camel-jms/src/generated/java/org/apache/camel/component/jms/JmsEndpointUriFactory.javacomponents/camel-jms/src/generated/resources/META-INF/org/apache/camel/component/jms/jms.jsonBoth are generated files whose baselines diverge between 4.14.x and main (different property counts / indices). Resolved by keeping the 4.14.x baseline (
--ours) and regenerating them locally against the 4.14.x source — theRegencommit on this branch contains that regeneration.Skipped
The original
Regencommite1d060f2147from #22598 touched many downstream JMS-family catalog files (camel-activemq, camel-activemq6, camel-amqp, camel-sjms2, camel-catalog, DSL factories) whose 4.14.x content diverges from main. It was skipped in favor of the locally-regeneratedcamel-jmscatalog in this PR. Other downstream catalogs on 4.14.x can be regenerated in a follow-up if/when CI flags a catalog mismatch.Verification
--ourson two generated files (regenerated in a separate commit)camel-jmsandcamel-sjmscompile cleanly on thecamel-4.14.xbaselineClaude Code on behalf of Andrea Cosentino