If you want to be really paranoid about running an untrusted
script:

my-words: make system/words []
unset bind difference [my-words system] copy next first system/words 'system
my-words/unset my-words/in system 'words

export-these-words: [
    print + - help ... etc
]

;-- Export some words that the untrusted script
;   is allowed to use. 
my-words/foreach word export-these-words [
    my-words/set word my-words/get my-words/in my-words word
]

my-words/if my-words/error? my-words/try [my-words/do %untrusted][...


;---------

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

  In fact, the object you create doesn't have to be called
  "my-words". It could be a randomly generated word.  Then
  even if people know your souce code they'll have a pretty
  hard time knowing where you hid the words because they can't
  look in system words.  

rand-word: does [to-word loop 10 [append "" #"A" + random 63]]

set rword: rand-word make system/words []

do compose/deep [
    unset bind difference [system (rword)] copy next first system/words 'system

    ( bind [
        unset in system 'words
        foreach word export-these-words [
            set word get in (to-lit-word rword) word
        ]
    ] rword )
    etc...


;--------

   In the second case we can avoid using all those paths by
   binding our unset and foreach code to the context referred
   to by our random word before that code is dropped into our
   block we're going to do (and before all the global words
   are unset).  

   What a swell language...

  -jeff


> On the  subject: as long as  you want to hide  something in
> Rebol, you  should consider System  as the first candidate,
> otherwise you allow the  script to try to  look for what it
> needs in System/words.
> 
> Ladislav
> 
> 

Reply via email to