Minor sandbox improvements.

* Check `sandbox-path-permissions' for bad values such as
  '(<perm> <path1> <path2>) where <path2> would get silently ignored.

* Try to clarify the intent of `call-in-sandbox-context' as a meta tool
  rather than a safe execution tool.
This commit is contained in:
Eli Barzilay 2013-03-03 03:36:51 -05:00
parent 0939cfcaf9
commit 75ece5c330
2 changed files with 15 additions and 6 deletions

View File

@ -150,7 +150,12 @@
(define sandbox-path-permissions
(make-parameter '()
(lambda (new)
(map (lambda (perm) (list (car perm) (path->bregexp (cadr perm))))
(map (lambda (perm)
(if (and (pair? perm) (symbol? (car perm))
(pair? (cdr perm)) (null? (cddr perm)))
(list (car perm) (path->bregexp (cadr perm)))
(error 'sandbox-path-permissions
"bad permission spec: ~e" perm)))
new))))
;; compresses the (sandbox-path-permissions) value to a "compressed" list of

View File

@ -931,11 +931,15 @@ evaluator. The call is performed under the resource limits and
evaluation handler that are used for evaluating expressions, unless
@racket[unrestricted?] is specified as true.
This process is usually similar to @racket[(evaluator (list thunk))], except
that it relies on the common meaning of list expressions as function
application (which is not true in all languages), and it relies on
@racket[eval] allowing non-S-expression input. In
addition, you can avoid some of the sandboxed restrictions by using
This process is usually similar to @racket[(evaluator (list thunk))],
except that it does not rely on the common meaning of a sexpr-based
syntax with list expressions as function application (which is not true
in all languages). Note that this is more useful for meta-level
operations such as namespace manipulation, it is not intended to be used
as a safe-evaluation replacement (i.e., using the sandbox evaluator as
usual).
In addition, you can avoid some of the sandboxed restrictions by using
your own permissions, for example,
@racketblock[
(let ([guard (current-security-guard)])