Skip to content

Commit

Permalink
Merge branch 'release_22.05' into release_23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Sep 21, 2023
2 parents 4bc24b5 + 5003134 commit fead133
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/galaxy/files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,16 @@ class ConfiguredFileSourcesConfig:
def __init__(
self,
symlink_allowlist=None,
fetch_url_allowlist=None,
library_import_dir=None,
user_library_import_dir=None,
ftp_upload_dir=None,
ftp_upload_purge=True,
):
symlink_allowlist = symlink_allowlist or []
fetch_url_allowlist = fetch_url_allowlist or []
self.symlink_allowlist = symlink_allowlist
self.fetch_url_allowlist = fetch_url_allowlist
self.library_import_dir = library_import_dir
self.user_library_import_dir = user_library_import_dir
self.ftp_upload_dir = ftp_upload_dir
Expand All @@ -236,6 +239,7 @@ def from_app_config(config):
# for this component.
kwds = {}
kwds["symlink_allowlist"] = getattr(config, "user_library_import_symlink_allowlist", [])
kwds["fetch_url_allowlist"] = getattr(config, "fetch_url_allowlist", [])
kwds["library_import_dir"] = getattr(config, "library_import_dir", None)
kwds["user_library_import_dir"] = getattr(config, "user_library_import_dir", None)
kwds["ftp_upload_dir"] = getattr(config, "ftp_upload_dir", None)
Expand All @@ -245,6 +249,7 @@ def from_app_config(config):
def to_dict(self):
return {
"symlink_allowlist": self.symlink_allowlist,
"fetch_url_allowlist": self.fetch_url_allowlist,
"library_import_dir": self.library_import_dir,
"user_library_import_dir": self.user_library_import_dir,
"ftp_upload_dir": self.ftp_upload_dir,
Expand All @@ -255,6 +260,7 @@ def to_dict(self):
def from_dict(as_dict):
return ConfiguredFileSourcesConfig(
symlink_allowlist=as_dict["symlink_allowlist"],
fetch_url_allowlist=as_dict["fetch_url_allowlist"],
library_import_dir=as_dict["library_import_dir"],
user_library_import_dir=as_dict["user_library_import_dir"],
ftp_upload_dir=as_dict["ftp_upload_dir"],
Expand Down
10 changes: 10 additions & 0 deletions lib/galaxy/files/uris.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ def stream_url_to_file(
temp.flush()
else:
page = urllib.request.urlopen(path, timeout=DEFAULT_SOCKET_TIMEOUT) # page will be .close()ed in stream_to_file
# default to no exceptions
ip_allowlist_reverify = []
if file_sources:
try:
ip_allowlist_reverify = file_sources._file_sources_config.fetch_url_allowlist
except AttributeError:
# may have existing serialized config at upgrade time?
pass
# Reverify non-local with open connection here
validate_non_local(page.geturl(), ip_allowlist_reverify)
temp_name = stream_to_file(
page, prefix=prefix, source_encoding=get_charset_from_http_headers(page.headers), dir=dir
)
Expand Down

0 comments on commit fead133

Please sign in to comment.