Harden XML parsing, serialization, and randomness (#3075)

This commit introduces several security hardening improvements across the codebase:
1. XML Processing: Hardened `TransformerFactory` and `SchemaFactory` instantiations in `EppMessage.java` by explicitly enabling `XMLConstants.FEATURE_SECURE_PROCESSING` and disabling external schema access.
2. Randomness: Replaced instances of `java.util.Random` with `java.security.SecureRandom` in `SelfSignedCaCertificate.java` for stronger entropy. (Added documentation in `ProxyModule.java` explaining why `java.util.Random` is intentionally retained there for metrics sampling).
3. Deserialization: Hardened `SerializeUtils.java` by injecting an `ObjectInputFilter` into the `ObjectInputStream`, restricting deserialization strictly to expected `google.registry` classes and standard Java collections.
This commit is contained in:
Ben McIlwain
2026-06-01 14:25:42 +00:00
committed by GitHub
parent c5abd2a7c9
commit 0030645b1a
7 changed files with 60 additions and 5 deletions
@@ -383,6 +383,10 @@ public class ProxyModule {
@Singleton
@Provides
static Random provideRandom() {
// Note: We intentionally use java.util.Random instead of SecureRandom here.
// This Random instance is injected into the hot path of the proxy exclusively for
// stochastic metrics sampling. Using SecureRandom would introduce severe lock
// contention and exhaust the system entropy pool under high load, causing DoS.
return new Random();
}