# How to create the most permissive security guard for a racket sandbox?

**URL:** <https://racket.discourse.group/t/how-to-create-the-most-permissive-security-guard-for-a-racket-sandbox/2071>\
**Category:** Questions & Answers\
**Tags:** question, security\
**Created:** [July 4, 2023, 9:47am UTC](https://racket.discourse.group/t/how-to-create-the-most-permissive-security-guard-for-a-racket-sandbox/2071 "2023-07-04T09:47:46Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Erich](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/erich/32/1233_2.png) [@Erich](https://racket.discourse.group/u/Erich)\
**Post date:** [July 6, 2023, 1:01pm UTC](https://racket.discourse.group/t/how-to-create-the-most-permissive-security-guard-for-a-racket-sandbox/2071/5 "2023-07-06T13:01:49Z")

</div>

Sorry for replying to my own questions but in case someone reads this later, I think I've got it working by setting the sandbox code-inspector to `(current-code-inspector)`. For some reason, this does _not_ work in `sandbox-init-hook`, which has been puzzling me. But it works using parameterize as follows:

```scheme
(define (create-evaluator)
  (define inspector (current-code-inspector))
  (parameterize ([sandbox-make-code-inspector
                  (lambda () inspector)])
    (make-evaluator
     'racket/gui
     #f
     #:requires '(racket/base racket/gui racket/random))))

(define evaluator (create-evaluator))

```

When I use this evaluator with the above `sandbox-init-hook`, I can use `(dynamic-require "module-name.rkt" 0)` and it will load and execute the plugin code at local path "module-name.rkt". A message-box in the GUI does not work even though the module starts with `#lang racket/gui`, it does something but the message box doesn't show up and it times out. However, I'm sure I can fix this.

---

_[View the full topic](https://racket.discourse.group/t/how-to-create-the-most-permissive-security-guard-for-a-racket-sandbox/2071)._
