From 8e67cc7cbb524e8e1b5b82061fd122612fcfa9aa Mon Sep 17 00:00:00 2001 From: mcilwain Date: Wed, 17 Oct 2018 15:43:22 -0700 Subject: [PATCH] Switch Random to SecureRandom Someone may @Inject a Random at some point in the future where security matters, so always provide a secure one. Also, this shouldn't be in ConfigModule (it's not configuration) -- but that can be changed separately. We might want a larger refactor that has a utils module or similar to provide extremely generic things like random number generators. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=217602486 --- java/google/registry/config/RegistryConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/google/registry/config/RegistryConfig.java b/java/google/registry/config/RegistryConfig.java index 24dfe3a58..5a3e9f01e 100644 --- a/java/google/registry/config/RegistryConfig.java +++ b/java/google/registry/config/RegistryConfig.java @@ -33,6 +33,7 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.net.URI; import java.net.URL; +import java.security.SecureRandom; import java.util.Optional; import java.util.Random; import java.util.stream.Collectors; @@ -1267,7 +1268,7 @@ public final class RegistryConfig { @Singleton @Provides public static Random provideRandom() { - return new Random(); + return new SecureRandom(); } }