Skip to content

Commit e5c9527

Browse files
fix: host check
1 parent dc80297 commit e5c9527

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/plugins/auth/src/android/PluginRetriever.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ public static void downloadPlugin(String token, String pluginUrl, String destFil
4141
connection.setReadTimeout(30000);
4242

4343
if (token != null && !token.isEmpty()) {
44-
if (url.getHost().endsWith("acode.app")) {
44+
String host = url.getHost();
45+
46+
if (host != null &&
47+
(host.equals("acode.app") || host.endsWith(".acode.app"))) {
4548
connection.setRequestProperty("x-auth-token", token);
46-
} else {
47-
Log.w(TAG, "Not adding auth token for untrusted URL: " + pluginUrl);
49+
}else {
50+
Log.w(TAG, "Not adding auth token for untrusted URL: " + url);
4851
}
4952
}
5053

@@ -94,9 +97,12 @@ public static JSONArray fetchJsonArray(String urlString, String token) {
9497
conn.setReadTimeout(5000);
9598

9699
if (token != null && !token.isEmpty()) {
97-
if (url.getHost().endsWith("acode.app")) {
100+
String host = url.getHost();
101+
102+
if (host != null &&
103+
(host.equals("acode.app") || host.endsWith(".acode.app"))) {
98104
conn.setRequestProperty("x-auth-token", token);
99-
} else {
105+
}else {
100106
Log.w(TAG, "Not adding auth token for untrusted URL: " + url);
101107
}
102108
}

0 commit comments

Comments
 (0)