Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.os.AsyncTask;

import com.owncloud.android.lib.common.utils.Log_OC;
import io.github.pixee.security.HostValidator;
import io.github.pixee.security.Urls;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -32,7 +34,7 @@ public LoadingVersionNumberTask(VersionDevInterface callback) {

protected Integer doInBackground(String... args) {
try {
URL url = new URL(args[0]);
URL url = Urls.create(args[0], Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS);
final Charset charset = Charset.defaultCharset();
try (BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), charset))) {
return Integer.parseInt(in.readLine());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import android.content.Context;
import android.net.Uri;
import io.github.pixee.security.HostValidator;
import io.github.pixee.security.Urls;

import org.apache.commons.codec.binary.Base64;

Expand All @@ -34,7 +36,7 @@ public CalendarSource(String url,
String password,
Context context) throws MalformedURLException {
if (url != null) {
mUrl = new URL(url);
mUrl = Urls.create(url, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS);
mString = mUrl.toString();
} else {
mUri = uri;
Expand All @@ -53,7 +55,7 @@ public URLConnection getConnection() throws IOException {
if (protocol.equalsIgnoreCase("ftp") || protocol.equalsIgnoreCase("ftps")) {
String external = mUrl.toExternalForm();
String end = external.substring(protocol.length() + HTTP_SEP.length());
return new URL(protocol + HTTP_SEP + userPass + "@" + end).openConnection();
return Urls.create(protocol + HTTP_SEP + userPass + "@" + end, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS).openConnection();
}

if (protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https")) {
Expand Down
Loading