Clojail: Life in a Clojure Prison
summary
Library Clojail (v0.5.0) combines the JVM SecurityManager with Clojure-side checks to sandbox evaluated code: it macro-expands and inspects forms, replaces the dot special form, enforces a per-user namespace model, limits defs (default max 5) and uses a 10 seconds timeout via a thunk that cancels thread groups (but not thread pools, so it disallows futures/agents). It ships with secure-tester and a no-death variant, supports init code, jvm false to disable JVM sandbox, and powers try-clojure, lazybot and 4clojure in production while admitting occasional holes that require updates.
AI-written summary · about
chapters (20)
- 0:00Start
- 5:15Code is dangerous!
- 5:31How often do you think of it like that?
- 7:04A sandbox can prevent...
- 7:23The JVM sandbox
- 8:53What if they rebind things?
- 9:09Facing these problems
- 9:58Rip apart code
- 12:15Extensibility
- 15:42Security Blanket
- 22:52Laying The Foundation
- 23:55A Simple Binding Spell
- 25:01Check ALL The Things!
- 28:00Clojail sandboxes in two stages.
- 31:07Sandboxing threads
- 32:05Finally, An Eval!
- 41:26Try Clojure
- 42:12Approach
- 44:59Guidelines for using Clojail in your own code •If you avoid sharing the
- 46:01Further reading
related talks
41mClojure for Ruby Programmers
32mLLMs Behind Bars: Sandboxes at Scale for AI on a Short Leash
38mMinijail: Running Untrusted Programs Safely
36mSandboxing Ruby: The Good, the Bad, and the Fugly
41mUsing Clojure with C APIs for crypto and more
31mclojure.web/with-security
46mSecure Web Applications with Clojure
44mSecuring the JVM
