Skip to content

fix(security): avoid serializing User in OnRegistrationCompleteEvent (CVE-2017-2603)#497

Open
navnitan-7 wants to merge 1 commit into
mindskip:masterfrom
navnitan-7:fix/cve-2017-2603-registration-event-serialization
Open

fix(security): avoid serializing User in OnRegistrationCompleteEvent (CVE-2017-2603)#497
navnitan-7 wants to merge 1 commit into
mindskip:masterfrom
navnitan-7:fix/cve-2017-2603-registration-event-serialization

Conversation

@navnitan-7

Copy link
Copy Markdown

Summary

Hardens OnRegistrationCompleteEvent against Java serialization leaking the full User graph (including password), following the same pattern as Jenkins CVE-2017-2603 / commit 3cd946c: mark the dedicated user field transient, add a serialization round-trip test, and parameterize Surefire so tests can run with -Dskip.unit.tests=false while keeping the previous default (tests skipped).

Reproduction (before)

  • source/xzs/src/main/java/com/mindskip/xzs/event/OnRegistrationCompleteEvent.java had private final User user; (non-transient).
  • Any code path that serializes the event could persist credentials from com.mindskip.xzs.domain.User.

Fix

  • private final transient User user + short Javadoc.
  • New OnRegistrationCompleteEventSerializationTest: after ObjectOutputStream / ObjectInputStream, getUser() is null.
  • pom.xml: <skip.unit.tests>true</skip.unit.tests> and <skipTests>${skip.unit.tests}</skipTests>.

Verification

cd source/xzs
mvn test -Dskip.unit.tests=false

Observed: BUILD SUCCESS; Surefire runs OnRegistrationCompleteEventSerializationTest.

mvn test

Observed: BUILD SUCCESS; tests still skipped by default.

Scope

  • Application code + one test class; no vendored trees changed.

Limitation

ApplicationEvent still receives super(user); this PR addresses the duplicate user field pattern aligned with the upstream fix. Further hardening could avoid passing the full User as the event source if required.

…VE-2017-2603)

Mark the dedicated user field transient so Java serialization cannot
rehydrate credentials. Add a round-trip serialization test. Parameterize
Surefire skip with skip.unit.tests so CI/maintainers can run tests with
-Dskip.unit.tests=false while preserving the previous default.

Made-with: Cursor
@navnitan-7

Copy link
Copy Markdown
Author

Hi reviewers,

I've addressed the security concern related to CVE-2017-2603 by marking the User field in OnRegistrationCompleteEvent as transient to prevent sensitive data from being serialized.
I also added a dedicated unit test to verify the serialization behavior and updated the Maven configuration to make test execution configurable.

Could you please take a look and share your feedback when you have a moment?

Thanks in advance!

@mindskip

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.

1 participant