sahuadarsh0 opened a new pull request, #3630:
URL: https://github.com/apache/maven-surefire/pull/3630

   Fixes #3612.
   
   ### Summary
   Hardens handling of the fork channel `sessionId` token:
   
   1. **Debug log redaction (`ForkStarter.java`):** Redacts the `sessionId` 
query parameter (`?sessionId=<redacted>` / `&sessionId=<redacted>`) when 
logging the fork-node connection string at debug level, while keeping the 
unredacted value serialized for the forked JVM.
   2. **Exception message redaction (`InvalidSessionIdException.java`):** 
Removes both supplied and expected session tokens from the exception message 
while preserving the existing public constructor signature.
   3. **Constant-time verification (`SurefireForkChannel.verifySessionId`):** 
Replaces `String.equals` with `MessageDigest.isEqual` over the ASCII token 
bytes.
   
   ### Testing
   - Added 
`ForkStarterTest.redactConnectionStringShouldMaskSessionIdQueryParameter` and 
`ForkStarterTest.forkDebugLogShouldRedactSessionIdFromConnectionString` to 
assert the raw token never appears in debug logs.
   - Updated `E2ETest.shouldNotVerifyClient` to assert neither the supplied nor 
expected `sessionId` appears in `InvalidSessionIdException.getMessage()`.
   - Verified with `mvn verify -pl maven-surefire-common` (931 tests, 0 
failures, 0 errors; Checkstyle, Spotless, RAT, and Animal Sniffer all passed).
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to