# Policy and OrgPolicy

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


> Constrain what a manifest may name: which git repositories a workstation may clone, where it may connect out to, which LLM models and providers an Integration may name, which Storage an upload or a session may keep its files in, which providers a workstation may run on, whether a member's computer may store workstations, what a workstation may reach on that computer, and whether a workstation may attach a model on a member's own computer.


Anyone who can write a manifest can point a workstation at any repository and let
it reach anything the network routes. A **Policy** (namespaced) or an **OrgPolicy**
(organization-wide) puts a bound on that, answering one question: *what may a
workstation manifest name?*

This page documents six governed items, the kinds of value a policy can limit:

- Git source locations (`gitSources`): the repositories a workstation clones into itself,
  via `spec.sources[].git.url` and `spec.dotfilesRepo.url`. The same rules judge the
  repositories an Integration's GitHub token may reach, as
  [Repositories a GitHub token may reach](#repositories-a-github-token-may-reach) describes.
- Egress destinations (`egressDestinations`): the places a workstation may connect out to,
  via `spec.egress.destinations[]`, and the hosts an
  [Integration](https://docs.ringleader.dev/reference/resources/integration/) connects its workstations to.
- LLM models (`llmModels`): the model an `llm` Integration names in
  `spec.llm.endpoint.model`, and the models a pi or OpenCode tool config names.
- LLM providers (`llmProviders`): where an `llm` Integration sends its prompts. That is the
  provider an Integration with `source: ringleader` names under `spec.llm.providers`. The
  same rules judge the providers a pi or OpenCode tool config names.
- Storage names (`storages`): the [Storage](https://docs.ringleader.dev/reference/resources/storage/) an upload or
  an agent session keeps its files in, named with `rl artifact upload --storage` or a session's
  `spec.lifecycle.transcriptStorageRef`.
- Workstation providers (`workstationProviders`): where a workstation runs, named in its
  `spec.provider`, such as `vz` or `gcp`.

A policy can also say whether a member's computer may store workstations itself, and what a
workstation may reach on that computer. That is the `device` block, described in
[A member's own computer](#a-members-own-computer).

```text
apiVersion: core.ringleader.dev/v1
kind: OrgPolicy      # cluster-scoped, written by an org admin
kind: Policy         # namespaced,      written by a namespace admin
```

[Namespace and organization policies](https://docs.ringleader.dev/organizations-teams/policies-identities/policies/) says how an apply that names a denied value is refused, how the OrgPolicies of an organization and the Policies of a namespace combine, how priority decides within a group and who may write each kind, with examples.

## Fields

| Field | Type | Description |
|-------|------|-------------|
| `org` | `string` | **`OrgPolicy` only, required.** The organization this policy belongs to. |
| `priority` | `int` | Orders an organization's OrgPolicies among themselves, or one namespace's Policies among themselves. Higher outranks lower, and an omitted priority counts as 0. On a namespaced `Policy` it is **capped at 100**. It never decides between an OrgPolicy and a Policy. |
| `rules` | `object` | One block per governed item kind: `gitSources`, `egressDestinations`, `llmModels`, `llmProviders`, `storages` and `workstationProviders`. An unknown key is refused at apply, so a typo cannot produce a policy that constrains nothing. |
| `device` | `object` | Settings for a member's own computer: `storeWorkstations`, and `hostAccess`, the limit on what a workstation reaches on that computer. See [A member's own computer](#a-members-own-computer). An unknown key or value is refused at apply. |

### A rule block

| Field | Type | Description |
|-------|------|-------------|
| `default` | `string` | `allow` or `deny`, the verdict for anything neither list matches. Omit it to defer to a lower-priority policy's default: an OrgPolicy defers to its organization's other OrgPolicies, and a Policy to its namespace's other Policies. If none of them declares one, the default is `allow`. |
| `allow` | `[]string` | Entries that permit a value. |
| `deny` | `[]string` | Entries that refuse a value. |

Declaring `default` and declaring nothing are genuinely different: an omitted default
defers, a declared one outranks.

## The priority cap

A namespaced `Policy`'s `priority` is capped at 100, and `rl apply` refuses a higher one. An
`OrgPolicy`'s priority has no cap. A negative priority is refused on both. The cap limits the
field only: because Ringleader never compares a Policy's priority with an OrgPolicy's, no number
a namespace administrator writes changes what the organization decides.

## Git source entries

A `gitSources` entry is a **host with an optional path prefix**, never a full URL:

```yaml
allow:
  - github.com                      # every repository on the host
  - github.com/acme                 # every repository under the acme owner
  - github.com/acme/platform        # exactly this repository, and anything below it
  - "*.internal.example"            # any sub-domain (never the bare apex)
  - git.example:2222                # a non-default port
```

- **Drop the scheme.** `https://github.com/acme` is refused; write `github.com/acme`.
- **No user part.** Write `github.com/acme`, not `git@github.com/acme`.
- **No whitespace.**
- **Paths match on segment boundaries.** `github.com/acme` covers
  `github.com/acme/platform` but never `github.com/acme-labs/x`.
- **`*.` matches one or more leading labels and never the apex.**
  `*.example.com` covers `git.example.com`, not `example.com`.
- **Matching is case-insensitive** on both host and path.

The same entry means the same thing wherever it is written, so a rule you test in one
policy behaves identically in another.

## Repositories a GitHub token may reach

An [Integration](https://docs.ringleader.dev/reference/resources/integration/) can get a short-lived GitHub token
from a [credential provider](https://docs.ringleader.dev/reference/resources/credentialprovider/#the-credential-source),
limited to the repositories its `credentialSource.repositories` lists. When an OrgPolicy or a
Policy for the Integration's namespace has a `gitSources` block, `rl apply` checks each entry of
that list against the same rules a workstation's clone address meets. The check covers a
credential source in `spec.httpProxy`, in `spec.mcp`, and under each provider in
`spec.llm.providers`.

Ringleader checks each entry as the address `https://<host>/<owner>/<name>`. For the shared
Ringleader GitHub App the host is `github.com`. For a provider with a
[GitHub App of your own](https://docs.ringleader.dev/reference/resources/credentialprovider/#githubapp), the host
is the one in the provider's `webURL`, without its port. A rule for `github.com/acme` does not cover a GitHub
Enterprise Server, so name that server's host in the rule.

For example, with this namespace policy:

```yaml
apiVersion: core.ringleader.dev/v1
kind: Policy
metadata:
  name: web-repos
  namespace: acme
spec:
  rules:
    gitSources:
      default: deny
      allow:
        - github.com/acme/api
        - github.com/acme/web
```

an Integration in `acme` that lists `repositories: [acme/api, acme/web]` is accepted. One that
lists `repositories: [acme/api, acme/billing]` is refused, and the message names the entry:

```text
forbidden: spec.httpProxy.credentialSource.repositories[1] names "acme/billing",
which your organization's or namespace's policy does not permit
```

Remove the entry, or ask an administrator to allow the repository, then apply again.

If the credential source leaves out `repositories`, its token would reach every repository the
GitHub App installation grants. Where a `gitSources` block is in force, `rl apply` refuses it:

```text
forbidden: spec.httpProxy.credentialSource.repositories is not set, and your
organization's or namespace's policy limits which git repositories may be used;
list the repositories the token may reach
```

Add the repositories the token needs and apply again. With no `gitSources` block, a source with
no list is accepted. `repositories: []` is not refused by this check either: it names no
repository, and Ringleader issues no token for it.

A credential source with `userAuthorization: boxOwner` is not checked. Its token acts as each
workstation's owner and reaches what that person can reach on GitHub, and Ringleader refuses a
`repositories` list beside it.

The check runs when someone applies or edits the Integration. An Integration applied before
the `gitSources` block existed keeps getting tokens for its list. The next time anyone applies
or edits it, the check runs, and an entry the rules do not permit, or a missing list, is
refused.

## Egress destination entries

An `egressDestinations` entry is written exactly as a destination is written in a
workstation's own [`egress`](https://docs.ringleader.dev/reference/resources/workstationconfig/#outbound-connection-restrictions)
block: a network, a bare address, or a name with an optional `*.` wildcard.

The same rules also judge each Integration when it is applied. They judge these hosts:

- The host an `llm` endpoint connects to, whether you wrote its `url` or the vendor supplies
  it. For `vendor: openrouter` that host is `openrouter.ai`, and a refusal names
  `spec.llm.endpoint.vendor`.
- Every host a [credential injection](https://docs.ringleader.dev/reference/resources/integration/#injection-fields) rule
  names.
- The host of an `mcp` server's `url`.

An Integration that names a host the policy does not permit is refused. Hosts listed under
`httpProxy.exclude` are not judged. Neither is the endpoint that an Integration with
`source: ringleader` connects its workstations to, because your deployment runs it.

```yaml
rules:
  egressDestinations:
    default: deny
    allow:
      - 10.0.0.0/8
      - 203.0.113.7
      - github.com
      - "*.githubusercontent.com"
```

Entries are matched by **containment**, not equality, and the asymmetry is the point: a
rule permitting `*.example.com` covers a workstation asking for `api.example.com`, while
a rule permitting `api.example.com` does **not** cover one asking for `*.example.com`,
because that workstation is asking for more than the rule grants.

**A name and an address never cover one another, in either direction.** Deciding that
would mean resolving the name, and a policy verdict must not depend on what DNS
answered at the moment it was evaluated. The consequence is worth knowing rather than
discovering: under `default: deny`, an allow list holding only names denies every
`cidr:` destination, and the reverse. An organization that means to permit both **writes
both**.

[Layers and the Policy limit](https://docs.ringleader.dev/security/outbound/outbound-restrictions/#layers-and-the-policy-limit)
says why a restriction written as a configuration layer is not a restriction, and why a limit
has to be a Policy.

## LLM model entries

An `llmModels` entry limits the `model` an `llm`
[Integration](https://docs.ringleader.dev/reference/resources/integration/) names in `spec.llm.endpoint.model`.
An entry is an exact model ID, or a prefix followed by one trailing `*`. It matches the model
ID as the provider spells it, and Ringleader adds no provider prefix. So Anthropic's own ID for
a model and OpenRouter's ID for the same model are two different entries:

```yaml
rules:
  llmModels:
    default: deny
    allow:
      - claude-sonnet-4-5               # Anthropic's ID, used when you call Anthropic directly
      - anthropic/claude-sonnet-4.5     # OpenRouter's ID for the same model
      - "openai/gpt-5*"                 # every OpenRouter ID that starts with openai/gpt-5
```

- Matching is case-insensitive.
- A `*` anywhere but at the end is refused, and so is a bare `*`. Use `default` to allow
  or deny every model.
- Only the model written in the Integration is judged. A program on the workstation can
  still ask the gateway for a different model when it calls it.

An entry with a slash, such as `anthropic/*`, matches OpenRouter's Anthropic models. It does not
match the models you reach through Anthropic directly, whose IDs have no slash. To limit which
provider a workstation uses, write [LLM provider entries](#llm-provider-entries) instead.

The same entries judge the models a `pi` or `opencode` tool config names in a Workstation or
WorkstationConfig, such as pi's `settings.defaultModel` or OpenCode's `settings.model`.
OpenCode's `settings.model` holds a provider, a slash and that provider's model ID, and only the
part after the first slash is checked. So OpenCode's `anthropic/claude-sonnet-4-5` is checked as
`claude-sonnet-4-5`, and `openrouter/anthropic/claude-sonnet-4.5` as
`anthropic/claude-sonnet-4.5`. A model outside the policy is refused when you apply the object,
and the message names the field. The
[pi](https://docs.ringleader.dev/reference/tools/tool-configuration/pi/#models-and-your-organizations-policy) and
[OpenCode](https://docs.ringleader.dev/reference/tools/tool-configuration/opencode/#models-and-your-organizations-policy)
pages list every field that is checked.

## LLM provider entries

An Integration with `source: ringleader` names the provider that your deployment's endpoint
sends its prompts to: `anthropic`, `openrouter` or `custom`. The `llmProviders` rules judge that
name. Each entry is one provider name and matches only that name. An organization that allows
only Anthropic writes:

```yaml
rules:
  llmProviders:
    default: deny
    allow:
      - anthropic
```

An Integration naming a provider the policy does not permit is refused when you apply it, and the
refusal names `spec.llm.providers.<provider>`. The endpoint also checks the policy on every
request. So once you tighten it, requests through an Integration applied earlier are refused
too, within 30 seconds of the change.

A `pi` or `opencode` tool config can name providers too, such as pi's
`settings.defaultProvider` or a key under OpenCode's `settings.provider`. Those names are free
text, and the `llmProviders` entries judge them the same way when you apply the Workstation or
WorkstationConfig.

## Storage entries

An upload or an agent session can name the [Storage](https://docs.ringleader.dev/reference/resources/storage/) that
keeps its files. The `storages` rules judge that name. Each entry is one Storage name and matches
only that exact name, so `*` and `/` are refused in an entry. A namespace that lets people name
only its EU bucket's Storage writes:

```yaml
rules:
  storages:
    default: deny
    allow:
      - transcripts-eu
```

An upload or a session naming a Storage the policy does not permit is refused when you apply it.
One that names no Storage uses the namespace's default, which these rules do not judge. Tightening
the policy later leaves files already stored where they are.

## Workstation provider entries

A `workstationProviders` entry names one provider a workstation can run on, such as `vz`,
`hcs`, `qemu`, `gcp`, `aws` or `azure`. Matching ignores case, and an entry that is not a
provider name Ringleader knows is refused when you apply the policy. An organization that runs
every workstation in its own GCP account writes:

```yaml
rules:
  workstationProviders:
    default: deny
    allow:
      - gcp
```

The rules judge the provider a Workstation names in `spec.provider`, and the one a
WorkstationPool's template names. When you create a workstation on a provider the policy does not
permit, or change a workstation's provider to one, the apply is refused and the message names
the field. A workstation already running on that provider keeps running, and you can still stop
and start it at the control plane.

On a member's own computer, Ringleader also skips a provider the policy does not permit when it
picks one for a workstation that names none.
[Rules your organization sets for your computer](https://docs.ringleader.dev/security/model/enforced-protections/#rules-your-organization-sets-for-your-computer)
says what else the computer does.

## A member's own computer

A workstation in the `local` namespace is stored only on the member's computer, and the control
plane never sees it. So is one an earlier release of `rl` stored on that computer in another
namespace. `device.storeWorkstations` says whether
a member's computer may store workstations like that. It takes `allow` or `deny`, and unset
means `allow`. An organization that wants every workstation stored at its control plane writes:

```yaml
apiVersion: core.ringleader.dev/v1
kind: OrgPolicy
metadata:
  name: acme-devices
spec:
  org: acme
  priority: 200
  device:
    storeWorkstations: deny
```

With `deny`, a member's computer refuses to create a workstation stored only on it, and the
message tells the member to create it in the organization's namespace while signed in. A
workstation created there is stored at the control plane, bound to the member's computer, and
every other rule on this page applies to it.

### Workstation reach on the computer

`device.hostAccess` limits what a workstation on a member's computer reaches of that computer:
its folders, its programs, its own `127.0.0.1` and its services. When a member asks for more than
the limit allows, the computer refuses the change. A workstation that already has more keeps
running, and has less from its next start. A setting you leave out of `hostAccess` sets no
limit:

| Setting | Values | What it limits |
|---------|--------|----------------|
| `mounts` | `any`, `readOnly` or `none` | The computer's folders a workstation shares: a vz workstation's `providerConfig.mounts`, and the local container runtime's shared folders. With `readOnly` they are shared read-only, and with `none` none is shared. |
| `localSources` | `allow` or `deny` | A `local` source, which copies a folder of the computer into the workstation. |
| `loopback` | `allow` or `deny` | Reaching the computer's own `127.0.0.1`, which a node-bound workstation asks for with `hostAccess.loopback: true`. With `deny`, a provider that always reaches it is a forbidden provider: qemu on a computer that cannot give it a restricted network. |
| `reverseForwards` | `allow` or `deny` | A LocalBinding's `reversePorts` and `reverseSockets`, which carry a service on the computer into a workstation. Forwards from a workstation to the computer are not limited. `ports` is the setting's old spelling and still works. |
| `localRuntime` | `allow` or `deny` | The local container runtime, which `rl local-runtime create` makes. |

An organization that lets its members share folders only read-only, and keeps their
workstations off the computer's localhost, writes:

```yaml
apiVersion: core.ringleader.dev/v1
kind: OrgPolicy
metadata:
  name: acme-host-access
spec:
  org: acme
  device:
    hostAccess:
      mounts: readOnly
      loopback: deny
```

[Limits on what a workstation reaches](https://docs.ringleader.dev/security/model/enforced-protections/#limits-on-what-a-workstation-reaches)
says what a member sees when a workstation goes over the limit.

### Combined settings

[OrgPolicy limits](https://docs.ringleader.dev/organizations-teams/policies-identities/policies/#orgpolicy-limits) and [Priority within one group](https://docs.ringleader.dev/organizations-teams/policies-identities/policies/#priority-within-one-group) say how the organization's and the namespace's settings combine, and that the stricter answer holds. For `mounts`, `none` is stricter than `readOnly`, and `readOnly` is stricter than `any`.

The member's computer enforces these settings and the `workstationProviders` rules itself.
[Rules your organization sets for your computer](https://docs.ringleader.dev/security/model/enforced-protections/#rules-your-organization-sets-for-your-computer)
says how, and what a person with administrator rights on that computer can still do.

## Operator limit on git hosts

An operator can configure a Ringleader deployment with its own allowlist of permitted git
hosts. That allowlist is a **limit** above every policy: a policy can narrow within it and
never widen past it. If a repository is refused and no policy of yours mentions it, the
deployment itself does not permit that host. Ask whoever operates your Ringleader deployment.

## CLI

```bash
rl apply -f orgpolicy.yaml
rl orgpolicy get                          # alias: opol
rl policy get -n payments                 # alias: pol
rl policy describe no-vendor-sdk -n payments
```

## Next steps
- [WorkstationConfig](https://docs.ringleader.dev/reference/resources/workstationconfig/): `sources[]` and
  `dotfilesRepo`, the workstation fields a `gitSources` policy governs.
- [Credential providers](https://docs.ringleader.dev/reference/resources/credentialprovider/#the-credential-source):
  `credentialSource.repositories`, the Integration field a `gitSources` policy governs.
- [Organization and OrgDomain](https://docs.ringleader.dev/reference/resources/organization/): who counts as an org admin.
- [Roles and RoleBindings](https://docs.ringleader.dev/reference/resources/roles/): namespace roles.

