KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I would like to let my users use regular expressions for some features. I'm curious what the implications are of passing user input to re.compile(). I assume there is no way for a user to give me a string that could let them execute arbitrary code. The dangers I have thought of are: The user could pass input that raises an exception. The user could pass input that causes the regex engine to take a long time, or to use a lot of memory. The solution to 1. is easy: catch exceptions. I'm not sure if there is a good solution to 2. Perhaps just limiting the length of the regex would work. Is there anything else I need to worry about?
Tags (comma-separated)
Save Edits
Cancel