# Rule locations

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> A rule about a workstation can live inside it, at the edge of its VM or outside it.


A rule is a limit on what a workstation can do or reach, such as which folders it sees or which hosts
it connects to. A rule about a workstation can live in one of three places, and where it lives decides
whether the coding agent can change it:

- Inside the workstation, where the agent can change any rule.
- At the edge of its VM, the VM boundary, where a rule protects your computer.
- Outside the workstation, where a rule limits where it may connect and what its requests carry, and
  the agent cannot change it.

The sections below take each place in turn.

## Rules inside the workstation

The agent's own settings, its list of allowed tools and the workstation's network configuration are
all files and processes. The agent can edit or stop any of them. The login user has passwordless sudo
by default. Setting `identity.sudo: false` does not change that on most providers, and a provisioning
script in the `system` phase runs as root either way.
[Login user](https://docs-stg.ringleader.dev/workstations/packages-tools-settings/users-environment-system-settings/#login-user)
says where `sudo: false` takes effect.

## The VM boundary

At the edge of the workstation is the VM boundary. The workstation shares none of your folders, except
on vz the ones you list under `mounts`. On vz and hcs it has no path to services on your computer.
[Loopback reach](https://docs-stg.ringleader.dev/workstations/connectivity/host-access-loopback/#loopback-reach)
says when a qemu workstation reaches your computer's `127.0.0.1`. The boundary does not cover the rest
of your network. A vz or hcs workstation with no `egress` block reaches other computers on your
network, and anything your VPN routes to.

## Ways across the boundary

These are the ways across the boundary, each of which you turn on:

- A folder you list under `providerConfig.mounts` is shared with the workstation. The workstation
  reads it, and changes it only if the share sets `writable: true`. Only vz shares folders, and
  your organization may limit them.
- A [LocalBinding](https://docs-stg.ringleader.dev/reference/resources/localbinding/) forwards the ports you name, in
  either direction, or every port the workstation listens on if you ask for that. Its
  `reversePorts` and `reverseSockets` connect the workstation to a port or a Unix socket on your
  computer. Only the owner of your computer can forward one of its services into the workstation.
- A LocalBinding's `urlForward` sends the links a workstation asks to open to your computer.
  A link opens in your browser without asking only when your URL open rules say `open`, as
  [Browser sign-in](https://docs-stg.ringleader.dev/workstations/connectivity/browser-sign-in/) explains.
  A WorkstationConfig's `defaultLocalBinding` can turn `urlForward` on for a workstation that
  is not node-bound, so check the configurations its labels select. A node-bound workstation
  takes no host access from a configuration.
- An [SSHKey](https://docs-stg.ringleader.dev/reference/resources/sshkey/) lets programs in the workstation sign with a
  key on your computer while your computer is connected to the workstation. An SSHKey with no
  selector reaches every workstation.
- A `local` source in a WorkstationConfig's `spec.sources` copies a folder from your computer
  into the workstation each time the configuration is applied.

## Rules outside the workstation

What enforces the rules outside the workstation depends on where it runs:

- On a cloud, your cloud's firewall enforces the addresses the workstation may reach. An Edge, a
  small VM in your cloud account, enforces the host names, on ports 80 and 443.
- On vz, hcs and qemu, a Ringleader process on your computer, the network process, enforces them.
  Once a namespace administrator declares an Edge for the workstation, an edge VM on your computer
  does.

Whichever it is, it keeps the firewall rule and the list of allowed host names. It also keeps the
injected key and the signing key of the certificate authority the workstation trusts. None of them
is on the workstation.
[Enforcement points](https://docs-stg.ringleader.dev/security/outbound/enforcement/) says what holds a policy on
each provider.

A list of host names also needs an address rule underneath it that refuses everything else. The name
is read off the connection, so without that rule an agent could dial an address directly and go
around the list.

*Illustration: The three places a rule can live. Inside the workstation, the coding agent and its tools can run any command, root included, so the agent can change a rule kept there. The workstation is a VM of its own: your Mac or PC shares no folder into it, and a LocalBinding forwards only the ports you name. The workstation's only link out leads to its network process or Edge, outside it, which holds the firewall rule, the list of allowed host names, the injected key and the certificate authority's signing key, and is marked enforced. Only the connections those rules allow go on to the internet.* On a cloud, your cloud’s firewall and an Edge in your account take the place of the network process.


### Held-closed workstations

A `strict` workstation is held closed while whatever must serve its policy is not serving it yet: a
declared edge VM, or its own network process before it confirms the policy.
[Held-closed workstations](https://docs-stg.ringleader.dev/security/outbound/enforcement/#held-closed-workstations)
says what each provider reaches meanwhile and what ends it.

*Illustration: Two states of a workstation with enforcement strict. Served: whatever serves its policy, its network process or an edge VM, passes connections to destinations on the list and refuses the rest. Not served yet: that process or VM is not serving it, so it is held closed and reaches nothing, listed or not.* A local workstation needs no Edge: its own network process serves it, unless an administrator declares an edge VM.


## Files and accounts your computer keeps from the agent

These stay out of the workstation unless you open one of the ways above:

- Your shell profile and history, such as an API key exported in `~/.zshrc`.
- `~/.ssh` and its keys.
- The macOS Keychain.
- Your other repositories and their `.env` files.
- Your downloads.
- Your browser's cookies and signed-in sessions.

The network is the other way in, as [The VM boundary](#the-vm-boundary) says.
[Lock down Claude Code for unattended runs](https://docs-stg.ringleader.dev/guides/lock-down-claude-code/)
closes it, together with the other ways out.

## Example: a laptop before and after

Picture a developer's Mac with an Anthropic key exported in `~/.zshrc`, `.env` files in several
repositories, `gh` signed in and an SSH key in `~/.ssh`. A browser is signed in to GitHub and
the company's tools. This table says what an agent can reach on it:

| On the laptop | Agent in a workstation set up as in the guide | What would let the agent reach it |
| --- | --- | --- |
| The key in `~/.zshrc` | No | Sharing your home folder, or copying the key into the workstation. |
| `.env` files | No | Sharing a folder that holds them, or a local source of one. |
| `gh`'s token | No | Copying the token into the workstation. |
| The SSH key | No | An SSHKey, which lets it sign while the key is forwarded. |
| The signed-in browser | No | A `urlForward` together with the `open` action in your URL open rules, which lets it open pages that your browser loads with your cookies. |
| Your local network and VPN | No | Removing the `egress` block. |

## Setups compared

Aim for rules enforced outside the workstation. Use an `egress` block with `enforcement: strict`, a
credential injection rule for each key the agent needs, and a Policy or OrgPolicy for each limit a
member must not widen. If you do not yet know which destinations to allow, start
with `audit` and let it write the list. This is the configuration that holds against an
agent with root. A Policy or OrgPolicy covers a workstation that Ringleader stores: a
cloud workstation, or a [node-bound](https://docs-stg.ringleader.dev/workstations/basics/#node-bound-workstations)
local one. A workstation in the `local` namespace, or one an earlier release of `rl` stored on your
computer in another namespace, gets only the rules in
[Rules your organization sets for your computer](https://docs-stg.ringleader.dev/security/model/enforced-protections/#rules-your-organization-sets-for-your-computer).

Here is what each setup gives you, from least to most:

- Rules inside the workstation cost nothing to set up and are enough for a developer's own
  convenience. They are the agent's own settings, its list of allowed tools and a firewall
  configured inside the VM. The agent, or anything it runs, can change or remove them,
  because the login user has sudo and a `system` script runs as root.
- The VM boundary alone, with no `egress` block and keys placed inside, protects your
  computer and nothing else. The workstation reaches anything your network routes, and every
  process inside can read a key you placed there. That is enough for an experiment that holds no credentials and
  touches nothing private.
- Rules enforced outside the workstation need a list of destinations, which `audit` can
  write for you. On a cloud they also need an Edge if the list names hosts rather than
  addresses. They are enforced on vz, hcs, qemu and a cloud.

## Next steps

- [Lock down Claude Code for unattended runs](https://docs-stg.ringleader.dev/guides/lock-down-claude-code/) sets up
  Claude Code on your own computer so that the rules hold outside the workstation.
- [Enforced protections](https://docs-stg.ringleader.dev/security/model/enforced-protections/) lists what holds by default and what you turn on.
- [Edge management](https://docs-stg.ringleader.dev/security/outbound/edge-management/) says when a workstation needs an Edge to enforce host names.
- [LocalBinding](https://docs-stg.ringleader.dev/reference/resources/localbinding/) lists the fields that forward ports between your
  computer and a workstation.

