From 4ec42d28362cdc6252206a8b9d2f4cc9361c4def Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 4 Sep 2018 14:28:17 -0400 Subject: [PATCH] Enforce PAGE_MAXRAW, otherwise we have no way to differentiate between potentially all-integer 16 character identifiers. I can't think of a better way to do this, unfortunately. --- lib/galaxy/webapps/galaxy/controllers/page.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/galaxy/webapps/galaxy/controllers/page.py b/lib/galaxy/webapps/galaxy/controllers/page.py index b429cbbf2dc..010d24fc518 100644 --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -1006,6 +1006,7 @@ PAGE_CLASS_MAPPING = { 'Visualization': 'Visualization' } +PAGE_MAXRAW = 10**15 def _placeholderRenderForEdit(trans, item_class, item_id): return _placeholderRenderForSave(trans, item_class, item_id, encode=True) @@ -1014,6 +1015,8 @@ def _placeholderRenderForEdit(trans, item_class, item_id): def _placeholderRenderForSave(trans, item_class, item_id, encode=False): try: decoded_item_id = int(item_id) + if decoded_item_id >= PAGE_MAXRAW: + raise ValueError("Identifier larger than maximum expected raw int, must be already encoded.") encoded_item_id = trans.app.security.encode_id(item_id) except ValueError: decoded_item_id = trans.app.security.decode_id(item_id)