by enriquto · 7y ago · 0 comments
If anything, user-input strings must be treated as tainted whatever the case.
1) existing uses of .format() would break:
aifc.py: raise Error('marker {0!r} does not exist'.format(id))
2) existing uses of "%" formatting would break: argparse.py: result = '{%s}' % ','.join(choice_strs)
3) many regular expressions would break: uuid.py: if re.fullmatch('(?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):
4) existing strings which contain uuids would break: uuid.py: >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')1) customizable templates (can't allow the user to access arbitrary variables)
2) i18n (can't allow the translator to access arbitrary variables)
3) complex values being passed to .format() instead of some variable