To ensure backward compatibility, Security components that implement Serializable should have a serialVersionUID.
Based on internal testing across a few dozen JVMs, it appears that the serialVersionUID is consistent for Security's components. As such, we can safely add the calculated serialVersionUID value to each class that is missing it during the 6.4.x maintenance cycle.
- [x] #16274
- [x] Produce list of
Serializableclasses missingserialVersionUID - [ ] Fail build when a
Serializableclass is missing aserialVersionUID - [ ] Consider adding an exclusion list for classes we don't support being serialized
When addressing a class that is missing its serialVersionUID, please do the following:
- Add the calculated
serialVersionUID(IDEs can usually do this for you, or you can useserialverwhich ships with the JVM) - In
SpringSecurityCoreVersionSerializableTests, add the class and an example construction to thegeneratorByClassNamemap - Run
SpringSecurityCoreVersionSerializableTests#serializeCurrentVersionClasses. -
If successful, it will create a
{className}.serializedfile inconfig/src/main/resources/serialized:Run the other tests in
SpringSecurityCoreVersionSerializableTests; the class should be added to the list inshouldBeAbleToDeserializeClassFromPreviousVersion, the class should no longer be in the output forlistClassesMissingSerialVersionCommit the
Serialiizableclass(es) andSpringSecurityCoreVersionSerializableTests5. If unsuccessful, it is usually because one of its members is not serializable. Find the unserializable member; file a ticket to ensure that it is madeSerializable
You can also see the list of Serializable files by running:
./gradlew :spring-security-config:test --tests "*MissingSerialVersion*" -Pserialization
Comment From: jzheaux
This is a duplicate of https://github.com/spring-projects/spring-security/issues/16276