summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2022-04-02 16:21:55 +0200
committerJon Marius Venstad <venstad@gmail.com>2022-04-02 16:21:55 +0200
commit2b3c3922531eef06d114191ab1685d663c83301e (patch)
tree0d9b1decd293952442945a987020773122676d1d /configserver
parenta4bef5cc8746be403fdb0dbb952e80a2a6db6f33 (diff)
Require HTTP(S) protocol
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java
index b585f7e7e32..8072dab978f 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java
@@ -16,6 +16,8 @@ import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.file.Files;
+import java.util.List;
+import java.util.Locale;
/**
* @author baldersheim
@@ -96,6 +98,8 @@ public class ApplicationFileManager implements AddFileInterface {
file = new File(tmpDir, path.getRelative());
Files.createDirectories(file.getParentFile().toPath());
URL website = new URL(uri);
+ if ( ! List.of("http", "https").contains(website.getProtocol().toLowerCase(Locale.ROOT)))
+ throw new IllegalArgumentException("only HTTP(S) supported for URI type resources");
rbc = Channels.newChannel(website.openStream());
fos = new FileOutputStream(file);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);