Hi,

the GC problem has a work-around as can be seen below:

secure-do: func [
    {secure script execution}
    untrusted [block! file! string!] {untrusted script}
    security [block! word!] {specify net/file policy}
    hidden [block!] {words to hide}
    protected [block!] {words to protect}
    /local my-words my result sec-do
] [
    ; tell GC about secure-do
    sec-do: :secure-do
    ; hide Secure and Secure-do at least
    hidden: bind union hidden [secure secure-do] 'system
    ; hidden words are protected too
    protected: union hidden protected
    ; create a temporary storage for system/words
    my-words: make system/words []
    ; converts words to my words
    my: func [words] [bind/copy words in my-words 'system]
    ; file and net security
    security: do reduce ['secure security]
    do compose/deep [
        ; hide words
        unset hidden
        ; do untrusted script
        (my [error? set/any]) 'result (my 'try) :untrusted
        ; restore the protected words
        (my 'foreach) word protected [
            (my [set/any word get/any in]) my-words word
        ]
    ]
    ; restore file/net security
    do reduce ['secure security]
    get/any 'result
]

{ 
    example: 
    secure-do [1 / 1] 'throw [] []
}

> >   Crazy, no?  With REBOL you can be very possesive about your
> >   words.  No, they're MY words! :-)
> 
> >
> >    What a swell language...
> >
> >   -jeff
> >
> 

>     Ladislav


Reply via email to