Info Call to Random API

Description

List of all calls to methods that return pseudo-random values.

Recommendation

Do not seed Random with the current time because that value is more predictable to an attacker than the default seed.

The java.util.Random class must not be used either for security-critical applications or for protecting sensitive data. Use a more secure random number generator, such as the java.security.SecureRandom class.

Technical details

Method io.grpc.okhttp.OkHttpClientTransport.<init>() calling method java.util.Random.<init>()


    OkHttpClientTransport(java.net.InetSocketAddress p2, String p3, String p4, java.util.concurrent.Executor p5, javax.net.ssl.SSLSocketFactory p6, javax.net.ssl.HostnameVerifier p7, io.grpc.okhttp.internal.ConnectionSpec p8, int p9, io.grpc.internal.ProxyParameters p10, Runnable p11, io.grpc.internal.TransportTracer p12)
    {
        this.random = new java.util.Random();
        this.lock = new Object();
        this.logId = io.grpc.InternalLogId.allocate(this.getClass().getName());
        this.streams = new java.util.HashMap();
        this.attributes = io.grpc.Attributes.EMPTY;
        this.maxConcurrentStreams = 0;
        this.pendingStreams = new java.util.LinkedList();
        this.address = ((java.net.InetSocketAddress) com.google.common.base.Preconditions.checkNotNull(p2, "address"));
        this.defaultAuthority = p3;
        this.maxMessageSize = p9;
        this.executor = ((java.util.concurrent.Executor) com.google.common.base.Preconditions.checkNotNull(p5, "executor"));
        this.serializingExecutor = new io.grpc.internal.SerializingExecutor(p5);
        this.nextStreamId = 3;
        this.sslSocketFactory = p6;
        this.hostnameVerifier = p7;
        this.connectionSpec = ((io.grpc.okhttp.internal.ConnectionSpec) com.google.common.base.Preconditions.checkNotNull(p8, "connectionSpec"));
        this.stopwatchFactory = io.grpc.internal.GrpcUtil.STOPWATCH_SUPPLIER;
        this.userAgent = io.grpc.internal.GrpcUtil.getGrpcUserAgent("okhttp", p4);
        this.proxy = p10;
        this.tooManyPingsRunnable = ((Runnable) com.google.common.base.Preconditions.checkNotNull(p11, "tooManyPingsRunnable"));
        this.transportTracer = ((io.grpc.internal.TransportTracer) com.google.common.base.Preconditions.checkNotNull(p12));
        this.initTransportTracer();
        return;
    }

Method io.grpc.okhttp.OkHttpClientTransport.<init>() calling method java.util.Random.<init>()


    OkHttpClientTransport(String p2, java.util.concurrent.Executor p3, io.grpc.okhttp.internal.framed.FrameReader p4, io.grpc.okhttp.internal.framed.FrameWriter p5, int p6, java.net.Socket p7, com.google.common.base.Supplier p8, Runnable p9, com.google.common.util.concurrent.SettableFuture p10, int p11, Runnable p12, io.grpc.internal.TransportTracer p13)
    {
        this.random = new java.util.Random();
        this.lock = new Object();
        this.logId = io.grpc.InternalLogId.allocate(this.getClass().getName());
        this.streams = new java.util.HashMap();
        this.attributes = io.grpc.Attributes.EMPTY;
        this.maxConcurrentStreams = 0;
        this.pendingStreams = new java.util.LinkedList();
        this.address = 0;
        this.maxMessageSize = p11;
        this.defaultAuthority = "notarealauthority:80";
        this.userAgent = io.grpc.internal.GrpcUtil.getGrpcUserAgent("okhttp", p2);
        this.executor = ((java.util.concurrent.Executor) com.google.common.base.Preconditions.checkNotNull(p3, "executor"));
        this.serializingExecutor = new io.grpc.internal.SerializingExecutor(p3);
        this.testFrameReader = ((io.grpc.okhttp.internal.framed.FrameReader) com.google.common.base.Preconditions.checkNotNull(p4, "frameReader"));
        this.testFrameWriter = ((io.grpc.okhttp.internal.framed.FrameWriter) com.google.common.base.Preconditions.checkNotNull(p5, "testFrameWriter"));
        this.socket = ((java.net.Socket) com.google.common.base.Preconditions.checkNotNull(p7, "socket"));
        this.nextStreamId = p6;
        this.stopwatchFactory = p8;
        this.connectionSpec = 0;
        this.connectingCallback = p9;
        this.connectedFuture = ((com.google.common.util.concurrent.SettableFuture) com.google.common.base.Preconditions.checkNotNull(p10, "connectedFuture"));
        this.proxy = 0;
        this.tooManyPingsRunnable = ((Runnable) com.google.common.base.Preconditions.checkNotNull(p12, "tooManyPingsRunnable"));
        this.transportTracer = ((io.grpc.internal.TransportTracer) com.google.common.base.Preconditions.checkNotNull(p13, "transportTracer"));
        this.initTransportTracer();
        return;
    }

Method io.grpc.internal.RetriableStream.<clinit>() calling method java.util.Random.<init>()


    static RetriableStream()
    {
        io.grpc.internal.RetriableStream.GRPC_PREVIOUS_RPC_ATTEMPTS = io.grpc.Metadata$Key.of("grpc-previous-rpc-attempts", io.grpc.Metadata.ASCII_STRING_MARSHALLER);
        io.grpc.internal.RetriableStream.GRPC_RETRY_PUSHBACK_MS = io.grpc.Metadata$Key.of("grpc-retry-pushback-ms", io.grpc.Metadata.ASCII_STRING_MARSHALLER);
        io.grpc.internal.RetriableStream.CANCELLED_BECAUSE_COMMITTED = io.grpc.Status.CANCELLED.withDescription("Stream thrown away because RetriableStream committed");
        io.grpc.internal.RetriableStream.random = new java.util.Random();
        return;
    }

Method io.grpc.util.RoundRobinLoadBalancerFactory$RoundRobinLoadBalancer.<init>() calling method java.util.Random.<init>()


    RoundRobinLoadBalancerFactory$RoundRobinLoadBalancer(io.grpc.LoadBalancer$Helper p3)
    {
        this.subchannels = new java.util.HashMap();
        this.currentPicker = new io.grpc.util.RoundRobinLoadBalancerFactory$EmptyPicker(io.grpc.util.RoundRobinLoadBalancerFactory$RoundRobinLoadBalancer.EMPTY_OK);
        this.helper = ((io.grpc.LoadBalancer$Helper) com.google.common.base.Preconditions.checkNotNull(p3, "helper"));
        this.random = new java.util.Random();
        return;
    }

Method io.grpc.internal.ExponentialBackoffPolicy.<init>() calling method java.util.Random.<init>()


    public ExponentialBackoffPolicy()
    {
        this.random = new java.util.Random();
        this.initialBackoffNanos = java.util.concurrent.TimeUnit.SECONDS.toNanos(1);
        this.maxBackoffNanos = java.util.concurrent.TimeUnit.MINUTES.toNanos(2);
        this.multiplier = 1.6;
        this.jitter = 0.2;
        this.nextBackoffNanos = this.initialBackoffNanos;
        return;
    }

Method io.grpc.internal.DnsNameResolver.<init>() calling method java.util.Random.<init>()


    DnsNameResolver(String p2, String p3, io.grpc.Attributes p4, io.grpc.internal.SharedResourceHolder$Resource p5, io.grpc.internal.ProxyDetector p6)
    {
        String v5_6;
        this.random = new java.util.Random();
        this.addressResolver = io.grpc.internal.DnsNameResolver$JdkAddressResolver.INSTANCE;
        this.resourceResolver = new java.util.concurrent.atomic.AtomicReference();
        this.resolutionRunnable = new io.grpc.internal.DnsNameResolver$1(this);
        this.executorResource = p5;
        IllegalArgumentException v2_3 = new StringBuilder();
        v2_3.append("//");
        v2_3.append(((String) com.google.common.base.Preconditions.checkNotNull(p3, "name")));
        IllegalArgumentException v2_6 = java.net.URI.create(v2_3.toString());
        if (v2_6.getHost() == null) {
            v5_6 = 0;
        } else {
            v5_6 = 1;
        }
        com.google.common.base.Preconditions.checkArgument(v5_6, "Invalid DNS name: %s", p3);
        this.authority = ((String) com.google.common.base.Preconditions.checkNotNull(v2_6.getAuthority(), "nameUri (%s) doesn\'t have an authority", v2_6));
        this.host = v2_6.getHost();
        if (v2_6.getPort() != -1) {
            this.port = v2_6.getPort();
        } else {
            IllegalArgumentException v2_11 = ((Integer) p4.get(io.grpc.NameResolver$Factory.PARAMS_DEFAULT_PORT));
            if (v2_11 == null) {
                StringBuilder v4_2 = new StringBuilder();
                v4_2.append("name \'");
                v4_2.append(p3);
                v4_2.append("\' doesn\'t contain a port, and default port is not set in params");
                throw new IllegalArgumentException(v4_2.toString());
            } else {
                this.port = v2_11.intValue();
            }
        }
        this.proxyDetector = p6;
        return;
    }

Method org.jsoup.helper.DataUtil.mimeBoundary() calling method java.util.Random.<init>()


    static String mimeBoundary()
    {
        String v0_1 = new StringBuilder(32);
        java.util.Random v2_1 = new java.util.Random();
        int v3 = 0;
        while (v3 < 32) {
            char v4_0 = org.jsoup.helper.DataUtil.mimeBoundaryChars;
            v0_1.append(v4_0[v2_1.nextInt(v4_0.length)]);
            v3++;
        }
        return v0_1.toString();
    }

Method com.google.firebase.firestore.util.Util.<clinit>() calling method java.util.Random.<init>()


    static Util()
    {
        com.google.firebase.firestore.util.Util.rand = new java.util.Random();
        com.google.firebase.firestore.util.Util.COMPARABLE_COMPARATOR = new com.google.firebase.firestore.util.Util$1();
        com.google.firebase.firestore.util.Util.VOID_ERROR_TRANSFORMER = com.google.firebase.firestore.util.Util$$Lambda$1.lambdaFactory$();
        return;
    }

Method com.google.android.gms.measurement.internal.zzjs.zzjv() calling method java.util.Random.<init>()


    public final long zzjv()
    {
        if (this.zzty.get() != 0) {
            try {
                this.zzty.compareAndSet(-1, 1);
                return this.zzty.getAndIncrement();
            } catch (Throwable v1_2) {
                throw v1_2;
            }
        } else {
            try {
                Throwable v1_5 = new java.util.Random((System.nanoTime() ^ this.zzx().currentTimeMillis())).nextLong();
                long v3_1 = (this.zzag + 1);
                this.zzag = v3_1;
                return (v1_5 + ((long) v3_1));
            } catch (Throwable v1_7) {
                throw v1_7;
            }
        }
    }

Method com.google.common.hash.Striped64.<clinit>() calling method java.util.Random.<init>()


    static Striped64()
    {
        com.google.common.hash.Striped64.threadHashCode = new ThreadLocal();
        com.google.common.hash.Striped64.rng = new java.util.Random();
        com.google.common.hash.Striped64.NCPU = Runtime.getRuntime().availableProcessors();
        try {
            com.google.common.hash.Striped64.UNSAFE = com.google.common.hash.Striped64.getUnsafe();
            com.google.common.hash.Striped64.baseOffset = com.google.common.hash.Striped64.UNSAFE.objectFieldOffset(com.google.common.hash.Striped64.getDeclaredField("base"));
            com.google.common.hash.Striped64.busyOffset = com.google.common.hash.Striped64.UNSAFE.objectFieldOffset(com.google.common.hash.Striped64.getDeclaredField("busy"));
            return;
        } catch (Exception v0_7) {
            throw new Error(v0_7);
        }
    }

Method com.google.common.cache.Striped64.<clinit>() calling method java.util.Random.<init>()


    static Striped64()
    {
        com.google.common.cache.Striped64.threadHashCode = new ThreadLocal();
        com.google.common.cache.Striped64.rng = new java.util.Random();
        com.google.common.cache.Striped64.NCPU = Runtime.getRuntime().availableProcessors();
        try {
            com.google.common.cache.Striped64.UNSAFE = com.google.common.cache.Striped64.getUnsafe();
            com.google.common.cache.Striped64.baseOffset = com.google.common.cache.Striped64.UNSAFE.objectFieldOffset(com.google.common.cache.Striped64.getDeclaredField("base"));
            com.google.common.cache.Striped64.busyOffset = com.google.common.cache.Striped64.UNSAFE.objectFieldOffset(com.google.common.cache.Striped64.getDeclaredField("busy"));
            return;
        } catch (Exception v0_7) {
            throw new Error(v0_7);
        }
    }

Method com.google.android.gms.internal.measurement.zzz.generateEventId() calling method java.util.Random.<init>()


    public final long generateEventId()
    {
        long v0_1 = new com.google.android.gms.internal.measurement.zzl();
        this.zza(new com.google.android.gms.internal.measurement.zzam(this, v0_1));
        long v0_3 = ((Long) com.google.android.gms.internal.measurement.zzl.zza(v0_1.zzb(500), Long));
        if (v0_3 != 0) {
            return v0_3.longValue();
        } else {
            long v0_7 = new java.util.Random((System.nanoTime() ^ this.zzac.currentTimeMillis())).nextLong();
            long v2_1 = (this.zzag + 1);
            this.zzag = v2_1;
            return (v0_7 + ((long) v2_1));
        }
    }

Method com.facebook.internal.Utility.generateRandomString() calling method java.util.Random.<init>()


    public static String generateRandomString(int p2)
    {
        return new java.math.BigInteger((p2 * 5), new java.util.Random()).toString(32);
    }

Method org.jsoup.helper.HttpConnection$Response.initUnSecureTSL() calling method java.security.SecureRandom.<init>()


    private static declared_synchronized void initUnSecureTSL()
    {
        try {
            if (org.jsoup.helper.HttpConnection$Response.sslSocketFactory == null) {
                java.io.IOException v1_6 = new javax.net.ssl.TrustManager[1];
                v1_6[0] = new org.jsoup.helper.HttpConnection$Response$2();
                String v2_0 = javax.net.ssl.SSLContext.getInstance("SSL");
                v2_0.init(0, v1_6, new java.security.SecureRandom());
                org.jsoup.helper.HttpConnection$Response.sslSocketFactory = v2_0.getSocketFactory();
            }
        } catch (java.io.IOException v1_4) {
            throw v1_4;
        }
        return;
    }

Method com.google.android.gms.measurement.internal.zzjs.zzjw() calling method java.security.SecureRandom.<init>()


    final java.security.SecureRandom zzjw()
    {
        this.zzo();
        if (this.zztx == null) {
            this.zztx = new java.security.SecureRandom();
        }
        return this.zztx;
    }

Method com.google.android.gms.measurement.internal.zzjs.zzbl() calling method java.security.SecureRandom.<init>()


    protected final void zzbl()
    {
        this.zzo();
        com.google.android.gms.measurement.internal.zzeh v0_5 = new java.security.SecureRandom();
        long v1 = v0_5.nextLong();
        if (v1 == 0) {
            v1 = v0_5.nextLong();
            if (v1 == 0) {
                this.zzab().zzgn().zzao("Utils falling back to Random for random id");
            }
        }
        this.zzty.set(v1);
        return;
    }

Method com.facebook.GraphRequest.<clinit>() calling method java.security.SecureRandom.<init>()


    static GraphRequest()
    {
        com.facebook.GraphRequest.versionPattern = java.util.regex.Pattern.compile("^/?v\\d+\\.\\d+/(.*)");
        String v0_4 = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
        StringBuilder v1_1 = new StringBuilder();
        java.security.SecureRandom v2_0 = new java.security.SecureRandom();
        int v3_2 = (v2_0.nextInt(11) + 30);
        int v4 = 0;
        while (v4 < v3_2) {
            v1_1.append(v0_4[v2_0.nextInt(v0_4.length)]);
            v4++;
        }
        com.facebook.GraphRequest.MIME_BOUNDARY = v1_1.toString();
        return;
    }

Method com.appsflyer.r.ˏ() calling method java.security.SecureRandom.<init>()


    public static declared_synchronized String ˏ(ref.WeakReference p5)
    {
        try {
            if (p5.get() != null) {
                if (com.appsflyer.r.ˋ == null) {
                    String v2_0 = 0;
                    if (p5.get() != null) {
                        v2_0 = com.appsflyer.AppsFlyerLib.ˎ(((android.content.Context) p5.get())).getString("AF_INSTALLATION", 0);
                    } else {
                    }
                    if (v2_0 == null) {
                        try {
                            int v1_5 = new java.io.File(((android.content.Context) p5.get()).getFilesDir(), "AF_INSTALLATION");
                        } catch (android.content.SharedPreferences$Editor v5_5) {
                            com.appsflyer.AFLogger.afErrorLog("Error getting AF unique ID", v5_5);
                        }
                        if (v1_5.exists()) {
                            com.appsflyer.r.ˋ = com.appsflyer.r.ˊ(v1_5);
                            v1_5.delete();
                        } else {
                            int v1_9;
                            if (android.os.Build$VERSION.SDK_INT < 9) {
                                v1_9 = java.util.UUID.randomUUID().toString();
                            } else {
                                int v1_10 = System.currentTimeMillis();
                                StringBuilder v4_1 = new StringBuilder();
                                v4_1.append(v1_10);
                                v4_1.append("-");
                                v4_1.append(Math.abs(new java.security.SecureRandom().nextLong()));
                                v1_9 = v4_1.toString();
                            }
                            com.appsflyer.r.ˋ = v1_9;
                        }
                        android.content.SharedPreferences$Editor v5_4 = com.appsflyer.AppsFlyerLib.ˎ(((android.content.Context) p5.get())).edit();
                        v5_4.putString("AF_INSTALLATION", com.appsflyer.r.ˋ);
                        if (android.os.Build$VERSION.SDK_INT < 9) {
                            v5_4.commit();
                        } else {
                            v5_4.apply();
                        }
                    } else {
                        com.appsflyer.r.ˋ = v2_0;
                    }
                    if (com.appsflyer.r.ˋ != null) {
                        com.appsflyer.AppsFlyerProperties.getInstance().set("uid", com.appsflyer.r.ˋ);
                    }
                }
                return com.appsflyer.r.ˋ;
            } else {
                return com.appsflyer.r.ˋ;
            }
        } catch (android.content.SharedPreferences$Editor v5_8) {
            throw v5_8;
        }
    }