Skip to content

Conversation

ic0ns
Copy link
Contributor

@ic0ns ic0ns commented Jun 30, 2025

Summary

  • Fixed SpotBugs EI_EXPOSE_STATIC_REP2 and MS_EXPOSE_REP warnings in RandomHelper class
  • Added proper SpotBugs annotations to suppress warnings with detailed justification
  • Added comprehensive test to document the intentional design decision

Details

The RandomHelper class is designed for test environments where controlled randomness is required. The warnings were about exposing mutable static Random instance, which is intentional in this case to allow testing frameworks full control over randomness.

Changes made:

  • Added SpotBugs annotations dependency to pom.xml
  • Added @SuppressFBWarnings annotation to getRandom() method for MS_EXPOSE_REP
  • Added @SuppressFBWarnings annotation to setRandom() method for EI_EXPOSE_STATIC_REP2
  • Added test case to verify and document the intentional behavior
  • All tests pass and code is properly formatted with spotless

Test plan

  • Run all existing tests with mvn test
  • Run SpotBugs analysis to verify warnings are suppressed
  • Verify code formatting with mvn spotless:check
  • Added new test to document the intentional design

- Added SpotBugs annotations dependency
- Suppressed MS_EXPOSE_REP warning on getRandom() method
- Suppressed EI_EXPOSE_STATIC_REP2 warning on setRandom() method
- Added test to document intentional mutable Random exposure
- Added detailed justification for the design decision

The RandomHelper class is designed for test environments where controlled
randomness is required. Exposing the mutable Random instance is intentional
to allow testing frameworks full control over randomness.
@ic0ns ic0ns merged commit 011df6a into main Jun 30, 2025
12 checks passed
@ic0ns ic0ns deleted the fix-ei-expose-static-rep2 branch June 30, 2025 09:58
TrueSkrillor added a commit to tls-attacker/Protocol-Toolkit-BOM that referenced this pull request Jun 30, 2025
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