home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / tcl / 2266 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  1.8 KB

  1. Path: sparky!uunet!spool.mu.edu!agate!zonker.cs.berkeley.edu!dwallach
  2. From: dwallach@zonker.cs.berkeley.edu (Dan Wallach)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: Tcl as a safe multimedia mail language (was Re: Insecurity of tk)
  5. Date: 29 Dec 1992 22:01:27 GMT
  6. Organization: University of California, Berkeley
  7. Lines: 25
  8. Message-ID: <1hqhrnINNdgb@agate.berkeley.edu>
  9. References: <1992Dec28.004651.24596@walter.bellcore.com>
  10. NNTP-Posting-Host: zonker.cs.berkeley.edu
  11.  
  12. In article <1992Dec28.004651.24596@walter.bellcore.com> Nathaniel Borenstein <nsb@thumper.bellcore.com> writes:
  13. >True, but dangerous.  Before I would depend on this approach in a
  14. >production implementation, I would want to have a Tcl command that gave
  15. >me the names of all currently-defined Tcl commands.  I could then use an
  16. >"OK" list instead of a "DANGEROUS" list, which sounds like a much safer
  17. >approach.
  18.  
  19. This really isn't a problem.  "info commands" will list everything
  20. in your interpreter.  It's trivial to hack up your main procedure
  21. to rsource a "safety" script before accepting any user input.  If
  22. you're feeling really paranoid, just use Tcl_DeleteCommand() on
  23. all the dangerous things (e.g. exec).
  24.  
  25. Since *everything* is a command, you could potentially remove *everything*
  26. except for your own custom procedures.  No 'if', no 'while', no 'exit'.
  27. All you have to do is modify your main procedure.  Of course, some
  28. commands can be bad to nuke (try redefining 'info' and see how much
  29. breaks!  Fun for the whole family!), but if all you have are your
  30. own custom procs, you're fine.
  31.  
  32.  
  33. --
  34. Dan Wallach               "One of the most attractive features of a Connection
  35. dwallach@cs.berkeley.edu  Machine is the array of blinking lights on the faces
  36. Office#: 510-642-9585     of its cabinet." -- CM Paris Ref. Manual, v6.0, p48.
  37.