From c9a679429201b8af4d463476012ab8070a387174 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 25 Aug 2023 14:01:11 +0200 Subject: [PATCH] Fix bool assignment for use_remote_user The option `use_remote_user` was used an declared as bool in the codebase, but it was assigned the value of `single_user` in some cases and that option can be either a bool or an email address (str) causing the type validation to fail. --- lib/galaxy/config/__init__.py | 2 +- lib/galaxy/webapps/galaxy/buildapp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index e6a381a64da3..e18db96c5ec2 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -914,7 +914,7 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None: self.galaxy_data_manager_data_path = self.galaxy_data_manager_data_path or self.tool_data_path self.tool_secret = kwargs.get("tool_secret", "") self.metadata_strategy = kwargs.get("metadata_strategy", "directory") - self.use_remote_user = self.use_remote_user or self.single_user + self.use_remote_user = self.use_remote_user or bool(self.single_user) self.fetch_url_allowlist_ips = [ ipaddress.ip_network(unicodify(ip.strip())) # If it has a slash, assume 127.0.0.1/24 notation if "/" in ip diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 236da06dd71d..749372e24c42 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -1201,7 +1201,7 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf): # protects Galaxy from improperly configured authentication in the # upstream server single_user = conf.get("single_user", None) - use_remote_user = asbool(conf.get("use_remote_user", False)) or single_user + use_remote_user = asbool(conf.get("use_remote_user", False)) or bool(single_user) if use_remote_user: from galaxy.web.framework.middleware.remoteuser import RemoteUser