Not really. Try modifying ast.literal_eval. This will be quite secure.<br><br><div class="gmail_quote">On 17 August 2012 19:36, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Aug 17, 2012 at 11:28 PM, Eric Frederich<br>
<<a href="mailto:eric.frederich@gmail.com">eric.frederich@gmail.com</a>> wrote:<br>
> Within the debugging console, after importing all of the bindings, there<br>
> would be no reason to import anything whatsoever.<br>
> With just the bindings I created and the Python language we could do<br>
> meaningful debugging.<br>
> So if I block the ability to do any imports and calls to eval I should be<br>
> safe right?<br>
<br>
</div>Nope. Python isn't a secured language in that way. I tried the same<br>
sort of thing a while back, but found it effectively impossible. (And<br>
this after people told me "It's not possible, don't bother trying". I<br>
tried anyway. It wasn't possible.)<br>
<br>
If you really want to do that, consider it equivalent to putting an<br>
open SSH session into your debugging console. Would you give that much<br>
power to your application's users? And if you would, is it worth<br>
reinventing SSH?<br>
<br>
ChrisA<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br>