[REVERT/FIX] safe_eval: revert incorrect tentative fix for missing abs,reduce + correct fix.

WARNING: do not add regular __builtins__ or globals in the safe_eval context dictionary!! The whole point is not to have them available for security purposes!

bzr revid: odo@openerp.com-20100810134046-vrw8niq73axmz5vl
This commit is contained in:
Olivier Dony 2010-08-10 15:40:46 +02:00
parent 910cc41a51
commit 8b658219df
1 changed files with 3 additions and 5 deletions

View File

@ -259,13 +259,11 @@ def safe_eval(expr, globals_dict=None, locals_dict=None, mode="eval", nocopy=Fal
'dict': dict,
'list': list,
'tuple': tuple,
'map' : map,
'map': map,
'abs': abs,
'reduce': reduce,
}
)
builtions = globals_dict.get('__builtins__')
builtions.update(os.__builtins__)
return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: