Skip to content

Commit

Permalink
Adds TODOs and removes ftps, which doesn't work with URL
Browse files Browse the repository at this point in the history
  • Loading branch information
ncordon committed Feb 1, 2022
1 parent 2c06679 commit 432ff3d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion core/src/main/java/apoc/ApocConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,20 @@ public void isImportFileEnabled() {
}
}

/*
TODO
This needs to be cleaned up in 5.0
WebURLAccessRule was added in the database in 4.4.5, so it would
break backwards compatibility with 4.4.xx previous versions
*/
private void checkAllowedUrl(String url) throws IOException {
try {
URL parsedUrl = new URL(url);
InetAddress inetAddress = InetAddress.getByName(parsedUrl.getHost());

for (var blockedIpRange : blockedIpRanges)
{
if (blockedIpRange.contains(new IPAddressString( inetAddress.getHostAddress())))
if (blockedIpRange.contains(new IPAddressString(inetAddress.getHostAddress())))
{
throw new IOException("access to " + inetAddress + " is blocked via the configuration property "
+ ApocSettings.cypher_ip_blocklist.name());
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/apoc/ApocSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
*/
@ServiceProvider
public class ApocSettings implements SettingsDeclaration {
/*
TODO
This needs to be cleaned up in 5.0, along with cypher_ip_blocklist
The option was added in the database in 4.4.5, so it would
break backwards compatibility with 4.4.xx previous versions
*/
public static final SettingValueParser<IPAddressString> CIDR_IP = new SettingValueParser<>()
{
@Override
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/apoc/util/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public enum SupportedProtocols {
http(true, null),
https(true, null),
ftp(true, null),
ftps(true, null),
s3(Util.classExists("com.amazonaws.services.s3.AmazonS3"),
Util.createInstanceOrNull("apoc.util.s3.S3UrlStreamHandlerFactory")),
gs(Util.classExists("com.google.cloud.storage.Storage"),
Expand All @@ -69,7 +68,6 @@ public StreamConnection getStreamConnection(String urlAddress, Map<String, Objec
case hdfs:
return FileUtils.openHdfsInputStream(new URL(urlAddress));
case ftp:
case ftps:
case http:
case https:
case gs:
Expand Down

0 comments on commit 432ff3d

Please sign in to comment.