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

From: Jordan Johnson (jmj at fellowhuman.com)
Date: Tue Dec 4 01:55:03 EST 2012

Hi all,

My immediate need for a response to the message below has passed, but I'd still like to know for next time, at least if my idea of a solution was accurate.  Anybody?

Thanks,
jmj 
-- 
Sent from my Android phone with K-9 Mail.

Jordan Johnson <jmj at fellowhuman.com> wrote:

>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
>
>
>------------------------------------------------------------------------
>
>____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121203/45c980b8/attachment.html>

Posted on the users mailing list.