[Openmcl-devel] modify lisp reader such that :: is disallowed
Taoufik Dachraoui
taoufik.dachraoui at wanadoo.fr
Thu Jun 11 09:03:21 PDT 2009
Hi
The best I could find without hacking the ccl lisp reader is the
following:
(defparameter *secure-readtable* (copy-readtable nil))
(set-macro-character #\:
#'(lambda (s c)
(declare (ignore s c))
(progn
(setq *readtable* (copy-readtable nil))
(error "use of colons is not allowed")))
nil
*secure-readtable*)
Example:
? (let ((*readtable* *secure-readtable*)) (read))
:x
> Error: use of colons is not allowed
> While executing: #<Anonymous Function #x8ABC576>, in process
listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > (get-macro-character #\:)
NIL
NIL
1 > :pop
?
But with this, users will not be able to use keywords either.
Is there a way to know if the colon is the first character in the token?
Does the reader has accessible working variables that we can consult?
Kind regards
-Taoufk
On Jun 11, 2009, at 4:54 PM, Robert P. Goldman wrote:
>
> This seems like a mistake, anyway, because this won't stop a user
> from typing
>
> (eval (list (intern "ERASE-TAOUFIKS-HARD-DRIVE" (find-
> package :private-package))))
>
> I continue to think that trying to sandbox common lisp is a very big
> project for a novice.
>
> The browser builders are often getting sandboxing wrong for
> javascript, whích is a much simpler language.
> ___
> Robert P. Goldman
> Principal Scientist, SIFT, LLC
> www.sift.info
>
> ..... Original Message .......
> On Thu, 11 Jun 2009 14:40:14 +0200 "Taoufik Dachraoui" <taoufik.dachraoui at wanadoo.fr
> > wrote:
>> Hi
>>
>> I tried to modify the lisp reader such that the use of :: is
>> disallowed (throws an error) but failed.
>>
>> I tried to use set-macro-character and set-dispatch-macro-character
>> without success.
>>
>> example:
>>
>> ? ... set new lisp reader ....
>> ? test::x
>> Error: access to not exported symbols is forbidden
>>
>>
>> Kind regards
>>
>> -Taoufik
>>
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20090611/03bf1c23/attachment.htm>
More information about the Openmcl-devel
mailing list