Introduced protections against predictable RNG abuse

pull/496/head
pixeebot[bot] 2 years ago committed by FongMi
parent 58d7ff1d09
commit 957d461cdf
  1. 3
      quickjs/src/main/java/com/fongmi/quickjs/utils/Connect.java

@ -8,6 +8,7 @@ import com.github.catvod.utils.Util;
import com.google.common.net.HttpHeaders;
import com.whl.quickjs.wrapper.JSObject;
import com.whl.quickjs.wrapper.QuickJSContext;
import java.security.SecureRandom;
import java.util.List;
import java.util.Map;
@ -85,7 +86,7 @@ public class Connect {
}
private static RequestBody getFormDataBody(Req req) {
String boundary = "--dio-boundary-" + new Random().nextInt(42949) + "" + new Random().nextInt(67296);
String boundary = "--dio-boundary-" + new SecureRandom().nextInt(42949) + "" + new SecureRandom().nextInt(67296);
MultipartBody.Builder builder = new MultipartBody.Builder(boundary).setType(MultipartBody.FORM);
Map<String, String> params = Json.toMap(req.getData());
for (String key : params.keySet()) builder.addFormDataPart(key, params.get(key));

Loading…
Cancel
Save