Headline
CVE-2015-10062: Fix a critical security vulnerability where unsanitized user-modifiab… · blankenberg/galaxy-data-resource@50d65f4
A vulnerability, which was classified as problematic, was found in galaxy-data-resource up to 14.10.0. This affects an unknown part of the component Command Line Template. The manipulation leads to injection. Upgrading to version 14.10.1 is able to address this issue. The name of the patch is 50d65f45d3f5be5d1fbff2e45ac5cec075f07d42. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-218451.
@@ -360,46 +360,57 @@ def pretty_print_json(json_data, is_json_string=False): '#’: '__pd__’}
def restore_text(text): def restore_text( text, character_map=mapped_chars ): “""Restores sanitized text""” if not text: return text for key, value in mapped_chars.items(): for key, value in character_map.items(): text = text.replace(value, key) return text
def sanitize_text(text): def sanitize_text( text, valid_characters=valid_chars, character_map=mapped_chars, invalid_character=’X’ ): “"” Restricts the characters that are allowed in text; accepts both strings and lists of strings. and lists of strings; non-string entities will be cast to strings. “"” if isinstance( text, basestring ): return _sanitize_text_helper(text) elif isinstance( text, list ): return [ _sanitize_text_helper(t) for t in text ] if isinstance( text, list ): return map( lambda x: sanitize_text( x, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character ), text ) if not isinstance( text, basestring ): text = smart_str( text ) return _sanitize_text_helper( text, valid_characters=valid_characters, character_map=character_map )
def _sanitize_text_helper(text): def _sanitize_text_helper( text, valid_characters=valid_chars, character_map=mapped_chars, invalid_character=’X’ ): “""Restricts the characters that are allowed in a string""”
out = [] for c in text: if c in valid_chars: if c in valid_characters: out.append© elif c in mapped_chars: out.append(mapped_chars[c]) elif c in character_map: out.append( character_map[c] ) else: out.append(‘X’) # makes debugging easier out.append( invalid_character ) # makes debugging easier return '’.join(out)
def sanitize_param(value): def sanitize_lists_to_string( values, valid_characters=valid_chars, character_map=mapped_chars, invalid_character=’X’ ): if isinstance( values, list ): rval = [] for value in values: rval.append( sanitize_lists_to_string( value, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character ) ) values = ",".join( rval ) else: values = sanitize_text( values, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character ) return values
def sanitize_param( value, valid_characters=valid_chars, character_map=mapped_chars, invalid_character=’X’ ): """Clean incoming parameters (strings or lists)“"” if isinstance( value, basestring ): return sanitize_text(value) return sanitize_text( value, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character ) elif isinstance( value, list ): return map(sanitize_text, value) return map( lambda x: sanitize_text( x, valid_characters=valid_characters, character_map=character_map, invalid_character=invalid_character ), value ) else: raise Exception('Unknown parameter type (%s)' % ( type( value ) ))