# safety

who can make the runner change your code

the runner turns text into code changes, so who can reach it matters more than anything else. these are the exact rules

## on your laptop

the dev runner:

- listens on `127.0.0.1` only, checks each connection comes from this machine and that the request named this machine (which stops dns rebinding)
- answers browser requests only from pages this machine served, so neither another site in your browser nor another computer on your network can use it
- needs the box's header and a json body on anything that changes something, which a form or image on another site can't send

to reach it from elsewhere, start it with `--secret` and give the box the same `secret`. anyone with it can change your code, so treat it like commit access. without a secret it won't listen beyond this machine, and an app on another address needs `--origin`. the agent runs with your permissions

what the runner says to different callers:

_(on the web page there's a little interactive piece here, `apps/docs/playground/safety.tsx`, that visitors can change by typing into the box)_

## when the runner serves the app

- **identity comes from `identity` and nowhere else.** visitors never see the box and their hand-made requests are refused
- **changes come from the app's own pages,** same address, with the box's header and a json body, so another site can't borrow a signed-in visitor's browser
- **members are fenced in.** their changes only reach their own version, `memberPaths` limits the files and `memberCheck` the contents, and a change or build fix that breaks either gets taken back out. 20 requests a day unless you set `memberDailyLimit`, `dailyLimit` caps them all together, and only owners promote
- **guests' code stays in their own browser.** how that works is on [letting anyone change it](/guests)
- **the agent can work in a [sandbox](/sandboxes),** on a copy without your ignored files, and only a patch comes back
- **requests are bounded:** 4000 characters, and 15 minutes of agent before it's stopped

## the limits

without a sandbox a member's agent has the same access to the machine as an owner's, and `memberPaths` limits what a change touches, not what the agent reads. with one the agent is contained, but the code it writes still runs on the serving machine once built

whatever someone types, the agent will try with everything it can reach, and unsandboxed that includes reading a file and putting it on the page. so for strangers use a sandbox and browser-only pieces checked by `clientOnly()`, and otherwise only let people type who you'd let run an agent on that machine
