certorail
Confinement for LLM-authored tool calls using static analysis of Python.
A program written in a restricted subset of Python is analysed, checked against a security
policy, and — only if every filesystem and subprocess operation is proven to stay where the
policy allows — run in an isolated interpreter. Anything unprovable is rejected before it runs.
Quick Demo:
Here is Certorail being used in the development of Certorail:
Here is the program that Claude authored and executed:
for path in ("fuse/fuseview-lean/.lake/build/bin/fuseview-lean", "proofs/place/.lake/build/bin/place-check"):
data = open(path, "rb").read()
assert data[:4] == b"\x7fELF"
e_type = int.from_bytes(data[0x10:0x12], "little")
phoff = int.from_bytes(data[0x20:0x28], "little")
phentsize = int.from_bytes(data[0x36:0x38], "little")
phnum = int.from_bytes(data[0x38:0x3a], "little")
types = []
interp = None
for i in range(phnum):
h = data[phoff + i * phentsize: phoff + (i + 1) * phentsize]
p_type = int.from_bytes(h[0:4], "little")
types.append(p_type)
if p_type == 3: # PT_INTERP: the dynamic loader
off = int.from_bytes(h[8:16], "little")
size = int.from_bytes(h[0x20:0x28], "little")
interp = data[off:off + size].rstrip(b"\0").decode()
print(path.rsplit("/", 1)[1], "ELF type", e_type, "| PT_INTERP:", interp or "none", "| PT_DYNAMIC:", 2 in types)
This is regular old Python, executed by a coding agent without permission prompts, while statically
guaranteed to stay within my security policy. It parses the ELF headers of the two binaries Claude
had just built (also through Certorail) and uses that to answer my question about static vs dynamic linking.
Getting Started
Quickstart
Get uv and install from a checkout of
this repository:
git clone https://github.com/Certora/certorail.git
cd certorail
uv tool install .
Then, from the directory you want governed, run:
certorail init
See the full instructions in the setup guide. You will need uv and, on Linux, bubblewrap.
MacOS and Linux only for now, there is no support (yet) for Windows platforms.
Usage
There are two main entry points; certorail and certorail-run. The former is the control plane,
and is the expect method for you to manage your certorail installation and policies. certorail-run is
how the LLM is expected to execute programs via certorail. As part of the first time
certorail init process, you will have the option to configure Claude Code to whitelist certorail-run.
More agent integrations are coming soon!
What certorail does
certorail confines the programs that are run through it. It does not stop an agent from doing
anything else. If the agent can run a shell, edit files or call tools outside certorail, none of that
is checked, so certorail is only as good as the harness that makes certorail-run the agent's one
way to execute code. Claude Code's permission rules can do that; nothing in certorail
enforces it.
Programs run with your authority. A policy grant is trust you extend: a program that is allowed to
write under a directory, run a command or reach a host does so as you, and the program Certorail
runs do whatever those programs do. The analysis proves that the Certorail program stays within the grants; it does not
judge whether the grants were a good idea. Read the policy as carefully as you would a sudoers file. For
information on how to lockdown programs launched via certorail, see the grants guide.
A policy talks about names, not objects. A grant or a protection constrains the path a program
spells, not the file that path ends up at. The rule of thumb has four consequences worth
knowing: