1
0
mirror of https://github.com/google/nomulus synced 2026-01-11 00:10:36 +00:00

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
This commit is contained in:
mcilwain
2018-10-17 15:43:22 -07:00
committed by jianglai
parent 82252dfcd6
commit 8e67cc7cbb

View File

@@ -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();
}
}