Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MessageException handling in get_edit #18529

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Jul 10, 2024

Fixes
https://sentry.galaxyproject.org/share/issue/18f12e228c8d4cf0ac62001b5f5ad938/:

Message
Uncaught exception in exposed API method:
Stack Trace

Newest

Error: Odd-length string
  File "encodings/hex_codec.py", line 19, in hex_decode
    return (binascii.a2b_hex(input), len(input))
Error: decoding with 'hex' codec failed (Error: Odd-length string)
  File "galaxy/security/idencoding.py", line 94, in decode_id
    return int(unicodify(id_cipher.decrypt(codecs.decode(obj_id, "hex"))).lstrip("!"))
MalformedId: Wrong  id ( undefined ) specified, unable to decode.
  File "galaxy/web/framework/decorators.py", line 206, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 165, in get_edit
    data, message = self._get_dataset_for_edit(trans, dataset_id)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 433, in _get_dataset_for_edit
    id = self.decode_id(dataset_id)
  File "galaxy/webapps/base/controller.py", line 114, in decode_id
    return managers_base.decode_id(self.app, id)
  File "galaxy/managers/base.py", line 156, in decode_id
    return decode_with_security(app.security, id, kind=kind)
  File "galaxy/managers/base.py", line 160, in decode_with_security
    return security.decode_id(str(id), kind=kind)
  File "galaxy/security/idencoding.py", line 100, in decode_id
    raise galaxy.exceptions.MalformedId(

(Please replace this header with a description of your pull request. Please include BOTH what you did and why you made the changes. The "why" may simply be citing a relevant Galaxy issue.)
(If fixing a bug, please add any relevant error or traceback)
(For UI components, it is recommended to include screenshots or screencasts)

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.

Fixes
https://sentry.galaxyproject.org/share/issue/18f12e228c8d4cf0ac62001b5f5ad938/:
```
Message
Uncaught exception in exposed API method:
Stack Trace

Newest

Error: Odd-length string
  File "encodings/hex_codec.py", line 19, in hex_decode
    return (binascii.a2b_hex(input), len(input))
Error: decoding with 'hex' codec failed (Error: Odd-length string)
  File "galaxy/security/idencoding.py", line 94, in decode_id
    return int(unicodify(id_cipher.decrypt(codecs.decode(obj_id, "hex"))).lstrip("!"))
MalformedId: Wrong  id ( undefined ) specified, unable to decode.
  File "galaxy/web/framework/decorators.py", line 206, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 165, in get_edit
    data, message = self._get_dataset_for_edit(trans, dataset_id)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 433, in _get_dataset_for_edit
    id = self.decode_id(dataset_id)
  File "galaxy/webapps/base/controller.py", line 114, in decode_id
    return managers_base.decode_id(self.app, id)
  File "galaxy/managers/base.py", line 156, in decode_id
    return decode_with_security(app.security, id, kind=kind)
  File "galaxy/managers/base.py", line 160, in decode_with_security
    return security.decode_id(str(id), kind=kind)
  File "galaxy/security/idencoding.py", line 100, in decode_id
    raise galaxy.exceptions.MalformedId(
```
@github-actions github-actions bot added this to the 24.2 milestone Jul 10, 2024
@mvdbeek mvdbeek requested a review from a team July 17, 2024 10:49
@davelopez
Copy link
Contributor

This doesn't need backporting right?

@mvdbeek
Copy link
Member Author

mvdbeek commented Jul 17, 2024

I did a bit more refactoring than strictly necessary, and I've cherry-picked the commits onto the usegalaxy branch ... I could go either way on the backport.

@mvdbeek mvdbeek merged commit 68a591f into galaxyproject:dev Jul 17, 2024
53 of 54 checks passed
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