Skip to content

Commit

Permalink
feat: remove forceIgnoreHttpsCertificate for security
Browse files Browse the repository at this point in the history
  • Loading branch information
xfl03 committed Dec 15, 2023
1 parent 0ffa9ef commit d277269
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
3 changes: 0 additions & 3 deletions Common/src/main/java/customskinloader/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class Config {
//Function
public boolean enableDynamicSkull = true;
public boolean enableTransparentSkin = true;
public boolean forceIgnoreHttpsCertificate = false;
public boolean forceLoadAllTextures = true;
public boolean enableCape = true;
public int threadPoolSize = 8;
Expand Down Expand Up @@ -76,8 +75,6 @@ public static Config loadConfig0() {
config.updateLoadlist();
config.initLocalFolder();
config.threadPoolSize = Math.max(config.threadPoolSize, 1);
if (config.forceIgnoreHttpsCertificate)
HttpUtil0.ignoreHttpsCertificate();
if (config.enableCacheAutoClean && !config.enableLocalProfileCache) {
try {
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
Expand Down
27 changes: 0 additions & 27 deletions Common/src/main/java/customskinloader/utils/HttpUtil0.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,6 @@ public static boolean isLocal(String url){
return url != null && !url.startsWith("http://") && !url.startsWith("https://");
}

//From: http://blog.csdn.net/xiyushiyi/article/details/46685387
public static void ignoreHttpsCertificate(){
HostnameVerifier doNotVerify = new HostnameVerifier() {

public boolean verify(String hostname, SSLSession session) {
return true;
}
};
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[] {};
}
public void checkClientTrusted(X509Certificate[] chain, String authType){}
public void checkServerTrusted(X509Certificate[] chain, String authType){}
}};

try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryFacade());
HttpsURLConnection.setDefaultHostnameVerifier(doNotVerify);
} catch (Exception e) {
e.printStackTrace();
}
}

public static String parseAddress(String address) {
if(StringUtils.isEmpty(address))
return null;
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name=CustomSkinLoader
group=customskinloader
version=14.19
version=14.19.1

0 comments on commit d277269

Please sign in to comment.