Re: Restricting execution of the tcl script to a folder or below



Hello

Now I can see a lot of resources to setup the communication. What I do
not know is how can I prevent accidental or rogue script from causing
damage to the files outside of the folder from which it is supposed to
execute. Is this even possible?

Yes, you should read about "Safe Base" here: http://www.tcl.tk/man/tcl8.4/TclCmd/safe.htm
It allows you to create a safe interpreter as an environment for
exactly this purpose. With "-accessPath directoryList" you can
restrict from where [source] and [load] can use files. Also the safe
interpreter created with "Safe Base" can be configured to see only Tcl
commands, that you allow it to see. If you don't want any file-access,
you simply remove all [file], [open] and others from the interpreter
before executing the script. You can even replace [ope]/[read]/[write]
with your own guarded implementations, so that the executed script can
use those commands, but only in a way you allow it.

I think, this should perfectly match your needs.

HTH
Stephan

.



Relevant Pages

  • Re: Restricting execution of the tcl script to a folder or below
    ... not know is how can I prevent accidental or rogue script from causing ... interpreter created with "Safe Base" can be configured to see only Tcl ... Armed with the safe interpreter you might want to look at the sample ... tclet code associated with the SIMPL project to facilitate the ...
    (comp.lang.tcl)
  • Re: Restricting execution of the tcl script to a folder or below
    ... not know is how can I prevent accidental or rogue script from causing ... use those commands, but only in a way you allow it. ... Armed with the safe interpreter you might want to look at the sample ... tclet code associated with the SIMPL project to facilitate the ...
    (comp.lang.tcl)