Skip to content

Commit 3ffc123

Browse files
committed
feature: replace eval with ast.literal_eval
Used to unmarshal session and other data. It looks like the data is all literal values.
1 parent 835bade commit 3ffc123

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

roundup/backends/sessions_rdbms.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
class. It's now also used for One Time Key handling too.
66
"""
77
__docformat__ = 'restructuredtext'
8+
import ast
89
import time
910

1011
from roundup.anypy.html import html_escape as escape
1112
from roundup.backends.sessions_common import SessionCommon
1213

1314
def safe_eval(s):
14-
return eval(s, {"__builtins__": {}}, {})
15+
"""Restricted eval to eval a repr of a dict of constants.
16+
"""
17+
return ast.literal_eval(s)
1518

1619
class BasicDatabase(SessionCommon):
1720
''' Provide a nice encapsulation of an RDBMS table.

0 commit comments

Comments
 (0)