[Sugar-devel] programming on thin ice

Morgan Collett morgan.collett at gmail.com
Fri Jan 30 03:38:33 EST 2009


On Fri, Jan 30, 2009 at 04:59, Benjamin M. Schwartz
<bmschwar at fas.harvard.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Walter Bender wrote:
>> (1) A simple idea I am exploring are to allow Turtle Art users to
>> enter simple Python commands directly into a block, as per
>> http://sugarlabs.org/go/Image:Ta-sin.png
>
> Beautiful.
>
>> But here is my question:
>>
>> My code for #1 above is:
>>
>> def myfunc(lc, f, x):
>>     myf = "def f(x): return " + f
>>     userdefined = {}
>>     try:
>>         exec myf in globals(), userdefined
>>     except:
>>         raise logoerror("#syntaxerror")
>>     return userdefined.values()[0](x)
>>
>> What I am concerned about is making the system vulnerable by letting
>> arbitrary functions to execute within TA.
>
> Don't worry about it.  Three reasons:
>
> 1.  You're right.  Rainbow's protections here are strong.  The
> user-modified code can neither read nor write nor overwrite the contents
> of the Journal, for example.  There are lots of other bad things it could
> do, like fill the disk with junk, break the TurtleArt icons so that
> TurtleArt won't start, or flood the network, but
>
> 2.  the user is writing this code themselves.  They'd have to go to great
> lengths, just to (very temporarily) break their own machine.  Besides,
>
> 3.  the remaining issues in (1) should be fixed inside Rainbow, rather
> than ineffectually patched by each Activity.

Pippy already lets them write and run arbitrary code in the UI.

If they can run Terminal, they can write and run arbitrary code.

Regards
Morgan


More information about the Sugar-devel mailing list