Skip to content

Commit

Permalink
Add 'interactivetools_verify_ssl'
Browse files Browse the repository at this point in the history
  • Loading branch information
almahmoud committed Jul 6, 2024
1 parent d387970 commit f7aa5ca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/galaxy/config/schemas/config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,14 @@ mapping:
desc: |
Prefix to use in the formation of the subdomain or path for interactive tools
interactivetools_verify_ssl:
type: bool
default: false
required: false
desc: |
Do not mark interactive tool endpoint as active until an HTTPS connection
can be established
retry_interactivetool_metadata_internally:
type: bool
default: true
Expand Down
17 changes: 16 additions & 1 deletion lib/galaxy/managers/interactivetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
urlunsplit,
)

import requests
from sqlalchemy import (
or_,
select,
Expand Down Expand Up @@ -296,6 +297,18 @@ def remove_entry_point(self, entry_point, flush=True):
self.sa_session.commit()
self.propagator.remove_entry_point(entry_point)

def _ssl_check(self, url):
if self.app.config.interactivetools_verify_ssl:
try:
r = requests.get(url)
except requests.exceptions.SSLError:
return False
if r.status_code == 200:
return True
else:
return False
return True

def target_if_active(self, trans, entry_point):
if entry_point.active and not entry_point.deleted:
use_it_proxy_host_cfg = (
Expand All @@ -315,7 +328,9 @@ def target_if_active(self, trans, entry_point):
if not use_it_proxy_host_cfg:
return url_path

return urlunsplit((url_parts.scheme, url_host, url_path, "", ""))
end_url = urlunsplit((url_parts.scheme, url_host, url_path, "", ""))
if self._ssl_check(end_url):
return end_url

def _get_entry_point_url_elements(self, trans, entry_point):
encoder = IdAsLowercaseAlphanumEncodingHelper(trans.security)
Expand Down

0 comments on commit f7aa5ca

Please sign in to comment.