Skip to content

[22.05] Ensure guid is hexadecimal value#14588

Merged
nsoranzo merged 3 commits intogalaxyproject:release_22.05from
mvdbeek:fix_noisy_exception_logging_when_unicode_null_in_session_key
Sep 8, 2022
Merged

[22.05] Ensure guid is hexadecimal value#14588
nsoranzo merged 3 commits intogalaxyproject:release_22.05from
mvdbeek:fix_noisy_exception_logging_when_unicode_null_in_session_key

Conversation

@mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Sep 8, 2022

Fixes #14560:

File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/web/framework/middleware/error.py', line 165 in __call__
  app_iter = self.application(environ, sr_checker)
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/paste/recursive.py', line 85 in __call__
  return self.application(environ, start_response)
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/paste/httpexceptions.py', line 640 in __call__
  return self.application(environ, start_response)
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/web/framework/base.py', line 166 in __call__
  return self.handle_request(environ, start_response)
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/web/framework/base.py', line 222 in handle_request
  trans = self.transaction_factory(environ)
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/webapps/base/webapp.py', line 101 in <lambda>
  self.set_transaction_factory(lambda e: self.transaction_chooser(e, galaxy_app, session_cookie))
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/webapps/base/webapp.py', line 190 in transaction_chooser
  return GalaxyWebTransaction(environ, galaxy_app, self, session_cookie)
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/webapps/base/webapp.py', line 311 in __init__
  self._ensure_valid_session(session_cookie)
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/webapps/base/webapp.py', line 557 in _ensure_valid_session
  galaxy_session = self.session_manager.get_session_from_session_key(session_key=session_key)
File '/gpfs1/data/galaxy_server/galaxy-dev/lib/galaxy/managers/session.py', line 26 in get_session_from_session_key
  self.sa_session.query(self.model.GalaxySession)
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/orm/query.py', line 2819 in first
  return self.limit(1)._iter().first()
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/orm/query.py', line 2903 in _iter
  result = self.session.execute(
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/orm/session.py', line 1712 in execute
  result = conn._execute_20(statement, params or {}, execution_options)
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py', line 1631 in _execute_20
  return meth(self, args_10style, kwargs_10style, execution_options)
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/sql/elements.py', line 325 in _execute_on_connection
  return connection._execute_clauseelement(
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py', line 1498 in _execute_clauseelement
  ret = self._execute_context(
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py', line 1862 in _execute_context
  self._handle_dbapi_exception(
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py', line 2047 in _handle_dbapi_exception
  util.raise_(exc_info[1], with_traceback=exc_info[2])
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/util/compat.py', line 208 in raise_
  raise exception
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py', line 1819 in _execute_context
  self.dialect.do_execute(
File '/gpfs1/data/galaxy_server/galaxy-dev/.venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py', line 732 in do_execute
  cursor.execute(statement, parameters)
ValueError: A string literal cannot contain NUL (0x00) characters.

This got logged because 29bba73 narrowed the exception catching, but we didn't anticipate the ValueError raised by sqlalchemy. Ensuring the decoded session key is a hexadecimal value seems like a clean fix.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@mvdbeek mvdbeek force-pushed the fix_noisy_exception_logging_when_unicode_null_in_session_key branch from af32450 to ee57a98 Compare September 8, 2022 11:30
@mvdbeek mvdbeek force-pushed the fix_noisy_exception_logging_when_unicode_null_in_session_key branch from ee57a98 to cb0c925 Compare September 8, 2022 12:05
@mvdbeek mvdbeek force-pushed the fix_noisy_exception_logging_when_unicode_null_in_session_key branch from cb0c925 to d50ec2f Compare September 8, 2022 12:34
@nsoranzo nsoranzo force-pushed the fix_noisy_exception_logging_when_unicode_null_in_session_key branch from 6265dab to 9fa2d71 Compare September 8, 2022 14:55
@nsoranzo nsoranzo merged commit dc0ac34 into galaxyproject:release_22.05 Sep 8, 2022
@nsoranzo nsoranzo deleted the fix_noisy_exception_logging_when_unicode_null_in_session_key branch September 8, 2022 18:05
bernt-matthias added a commit to bernt-matthias/galaxy that referenced this pull request Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants