Skip to content

Commit

Permalink
Sandboxed URL creation to prevent SSRF attacks
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeebot[bot] authored Nov 17, 2024
1 parent b335cb7 commit e1abf85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/mindustry/net/BeControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import arc.func.*;
import arc.util.*;
import arc.util.serialization.*;
import io.github.pixee.security.HostValidator;
import io.github.pixee.security.Urls;
import mindustry.*;
import mindustry.core.*;
import mindustry.gen.*;
Expand Down Expand Up @@ -171,7 +173,7 @@ public void showUpdateDialog(){
private void download(String furl, Fi dest, Intc length, Floatc progressor, Boolp canceled, Runnable done, Cons<Throwable> error){
mainExecutor.submit(() -> {
try{
HttpURLConnection con = (HttpURLConnection)new URL(furl).openConnection();
HttpURLConnection con = (HttpURLConnection)Urls.create(furl, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS).openConnection();
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
OutputStream out = dest.write(false, 4096);

Expand Down

0 comments on commit e1abf85

Please sign in to comment.