Remove "java.lang" package as a default allowed serializable package#2026
Merged
Merged
Conversation
Many classes in the java.lang package should not ever need to be serialized so this commit removes the default package and instead includes an allow list of classes that are ok to serialize that are part of the package. Users have the option to restore the previous behavior by appending "java.lang" back to the serialized packages property if desired.
mattrpav
reviewed
May 19, 2026
|
|
||
| private void checkSecurity(Class clazz) throws ClassNotFoundException { | ||
| if (trustAllPackages() || clazz.isPrimitive()) { | ||
| if (trustAllPackages() || clazz.isPrimitive() || ALLOWED_JDK_TYPES.contains(clazz)) { |
Contributor
There was a problem hiding this comment.
This is a good change to permanently support these core types
jbonofre
approved these changes
May 20, 2026
cshannon
added a commit
to cshannon/activemq
that referenced
this pull request
May 20, 2026
…pache#2026) Many classes in the java.lang package should not ever need to be serialized so this commit removes the default package and instead includes an allow list of classes that are ok to serialize that are part of the package. Users have the option to restore the previous behavior by appending "java.lang" back to the serialized packages property if desired. (cherry picked from commit e9ed448)
cshannon
added a commit
to cshannon/activemq
that referenced
this pull request
May 20, 2026
…pache#2026) Many classes in the java.lang package should not ever need to be serialized so this commit removes the default package and instead includes an allow list of classes that are ok to serialize that are part of the package. Users have the option to restore the previous behavior by appending "java.lang" back to the serialized packages property if desired. (cherry picked from commit e9ed448)
cshannon
added a commit
that referenced
this pull request
May 20, 2026
…2026) (#2027) Many classes in the java.lang package should not ever need to be serialized so this commit removes the default package and instead includes an allow list of classes that are ok to serialize that are part of the package. Users have the option to restore the previous behavior by appending "java.lang" back to the serialized packages property if desired. (cherry picked from commit e9ed448)
cshannon
added a commit
that referenced
this pull request
May 20, 2026
…2026) (#2028) Many classes in the java.lang package should not ever need to be serialized so this commit removes the default package and instead includes an allow list of classes that are ok to serialize that are part of the package. Users have the option to restore the previous behavior by appending "java.lang" back to the serialized packages property if desired. (cherry picked from commit e9ed448)
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.
Many classes in the java.lang package should not ever need to be serialized so this commit removes the default package and instead includes an allow list of classes that are ok to serialize that are part of the package. Users have the option to restore the previous behavior by appending "java.lang" back to the serialized packages property if desired.
The main goal of this is to restrict the allowed list to help prevent any future issues that could be uncovered by allowing unnecessary types to be serialized.