[REBOL] Re: [bug?] Problem with 'load
From: SunandaDH:aol at: 4-Dec-2003 3:39
More problems with load.....
This may not be a bug, but I can't find a workaround.
I want to be able to safely load *any* script to check it has acceptable
syntax before allowing it into REBOL.org. But we absolutely don't want to evaluate
the header as that may execute untrusted code in server CGI mode.
But here I have a very simple, three-line script that defeats the existing
checks.
,
REBOL [print "header evaluated"]
print "body evaluated"
We know 'load is bad as it evaluates the header:
>> load {,^/REBOL [print "header evaluated"]^/print "body evaluated"}
header evaluated
== [
print "body evaluated"
]
So we are supposed to use 'load/all. But in this case:
>> load/all {,^/REBOL [print "header evaluated"]^/print "body evaluated"}
** Syntax Error: Invalid word -- ,
** Near: (line 1) ,
I can successfully and safely load the header using Romano's load-header
function:
http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=load-header.r
But this problem looks like it needs a different approach.
I could try saving it as a file and Do'ing it. The "proves" it is a
validly-formed script. But it evaluates the header and the body. Not what I want!
>> write %temp.r {,^/REBOL [print "header evaluated"]^/print "body evaluated"}
>> do %temp.r
header evaluated
body evaluated
Any ideas?
Thanks,
Sunanda.