Is there a way to secure strings for Python's eval?

后端 未结 7 2068
悲哀的现实
悲哀的现实 2021-02-08 07:43

There are many questions on SO about using Python\'s eval on insecure strings (eg.: Security of Python\'s eval() on untrusted strings?, Python: make eval safe).

相关标签:
7条回答
  • 2021-02-08 08:18

    You probably should avoid eval, actually.

    But if your stuck with it, you could just make sure your strings are alphanumeric. That should be safe.

    0 讨论(0)
提交回复
热议问题