Restrict URL protocol types loaded by XBeanBrokerFactory#1910
Merged
cshannon merged 2 commits intoapache:mainfrom Apr 13, 2026
Merged
Restrict URL protocol types loaded by XBeanBrokerFactory#1910cshannon merged 2 commits intoapache:mainfrom
cshannon merged 2 commits intoapache:mainfrom
Conversation
This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded. The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default.
a75a846 to
ab6c5ad
Compare
jbonofre
previously approved these changes
Apr 13, 2026
| import org.apache.activemq.broker.BrokerService; | ||
| import org.apache.activemq.spring.SpringBrokerContext; | ||
| import org.apache.activemq.spring.Utils; | ||
| import org.apache.activemq.transport.stomp.FrameTranslator; |
Member
There was a problem hiding this comment.
It seems these imports are not actually used in the factory.
Maybe coming from previous dev ?
Contributor
Author
There was a problem hiding this comment.
Probably, we really need a plugin to check imports (I've mentioned this before), it's too easy for imports to leak in by mistake when making a lot of changes and refactoring.
| public static final String XBEAN_BROKER_FACTORY_PROTOCOLS_PROP = | ||
| "org.apache.activemq.xbean.XBEAN_BROKER_FACTORY_PROTOCOLS"; | ||
| public static final String DEFAULT_ALLOWED_PROTOCOLS = | ||
| String.join(",", Set.of(Utils.FILE_PROTOCOL, Utils.CLASSPATH_PROTOCOL)); |
Member
There was a problem hiding this comment.
There's no guarantee of order here: it could be file,classpath or classpath,file.
Why not just using a simple Utils.FILE_PROTOCOL + "," + Utils.CLASSPATH_PROTOCOL.
Contributor
Author
There was a problem hiding this comment.
Order shouldn't matter but doing that is fine too and easier to read
jbonofre
approved these changes
Apr 13, 2026
cshannon
added a commit
to cshannon/activemq
that referenced
this pull request
Apr 13, 2026
This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded. The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default. (cherry picked from commit 85fa7bb)
cshannon
added a commit
to cshannon/activemq
that referenced
this pull request
Apr 13, 2026
This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded. The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default. (cherry picked from commit 85fa7bb)
cshannon
added a commit
that referenced
this pull request
Apr 13, 2026
This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded. The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default. (cherry picked from commit 85fa7bb)
cshannon
added a commit
that referenced
this pull request
Apr 13, 2026
This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded. The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default. (cherry picked from commit 85fa7bb)
cshannon
added a commit
that referenced
this pull request
Apr 13, 2026
pburgess147
pushed a commit
to peersoftware/activemq
that referenced
this pull request
Apr 17, 2026
apache#1915) This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded. The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default. (cherry picked from commit 85fa7bb)
This was referenced Apr 21, 2026
jgallimore
added a commit
to tomitribe/activemq
that referenced
this pull request
Apr 24, 2026
apache#1916) Cherry-picked from 5.19.x: e1802c8
jgallimore
added a commit
to tomitribe/activemq
that referenced
this pull request
Apr 24, 2026
apache#1916) Cherry-picked from 5.19.x: e1802c8
jgallimore
added a commit
to tomitribe/activemq
that referenced
this pull request
Apr 24, 2026
apache#1915) Cherry-picked from 6.2.x: d88c0ed
jgallimore
added a commit
to tomitribe/activemq
that referenced
this pull request
Apr 24, 2026
apache#1915) Cherry-picked from 6.2.x: d88c0ed
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.
This adds a new system property to control which protocol types are valid for loading resources using the XBeanBrokerFactory. By default only file and classpath resources can be loaded.
The goal of this is to prevent possible future security issues by hardening what is allowed to be loaded by default. There have been a lot of previous CVEs reported that were made possible by allowing remoting loading of Spring contexts (ie using http) so this will help stop any future vulnerabilities from being discovered but just no longer allowing that out of the box.
This PR does the following:
XBeanBrokerFactory(and vm transport that uses it) with classpath and file allowed by default.org.apache.activemq.xbean.XBEAN_BROKER_FACTORY_PROTOCOLSclasspath,fileso we only allow those resources.*can be used to allow all and empty string to allow none.Closes #1899