[racket] Where to hook into handin-server for sandbox-network-guard

From: Jordan Johnson (jmj at fellowhuman.com)
Date: Tue Nov 27 15:47:34 EST 2012

Hi all,

I have my students handing in an assignment via the handin server, in which
I've asked them to use bitmap/url to load a particular image from my Web
server.  This obviously runs afoul of the sandbox  rules, so I looked into
the sandbox configuration docs and believe that what I need to do is
something like

> (sandbox-network-guard
>   (lambda (caller host port cli/srv)
>     (unless (and (equal? host "my-server.com")
>                  (= port 80)
>                  (eq? cli/srv 'client))
>       (error caller
>              "network permissions denied; failed to contact ~a:~a"
>              host port))))

(I would restrict it further to allow only fetching the one particular
file, but don't see how.)  The question I have is, how should I install
this lambda in the sandbox-network-guard parameter so that it works
properly?  The problems I see are:

1. If I simply include the above code before the (check: ...) expression,
it seems to work correctly for  the first assignment handed in, and none
thereafter.

2. Writing (parameterize ([sandbox-network-guard (lambda ...)]) (check:
...)) doesn't work, because (check: ...) must be at top-level to provide
the checker function.

Thanks,
jmj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121127/50b0a31b/attachment.html>

Posted on the users mailing list.