Namespace and organization policies
A policy limits what the files you apply may name, such as git repositories, egress destinations, models, Storage and providers.
A policy limits what the files you apply may name: which git repositories a workstation clones, where it connects, and which models, Storage and providers it uses. An organization writes an OrgPolicy that limits every namespace it owns, and a namespace writes a Policy to narrow its own. Write one when a rule has to hold no matter what a workstation file says.
Policies and OrgPolicies
Anyone who can write a workstation file 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. It answers one question: what may a workstation file name?
Policy and OrgPolicy lists the governed items, the fields and the entry syntax for each. Every governed item ships with a permissive default, so a deployment with no policy objects behaves as it did before policies existed. You opt in by writing one.
A policy can also say whether a member’s computer may store workstations and what a workstation may reach on that computer. Rules your organization sets for your computer says how the computer enforces those settings.
Refusals
An apply that names something the resolved policy denies is refused, with a message naming the field and the value that was rejected. Nothing is silently dropped.
remote: forbidden: spec.egress.destinations[1].cidr names "8.8.8.8/32",
which your organization's or namespace's policy does not permit (HTTP 403)The message never names the policy that decided. An OrgPolicy is cluster-scoped, so an ordinary namespace member cannot read one, and naming it would disclose an object they have no access to. Which policy decided, and at what priority, goes to the audit log instead. Reading the audit record needs whoever operates your Ringleader deployment.
OrgPolicy limits
Several policies can apply to one namespace: its own Policy objects, and every OrgPolicy of the organization that owns it. Ringleader reads them as two groups. The organization’s OrgPolicies give one answer, the namespace’s Policies give another, and a value is allowed only when both answers allow it.
So a namespace Policy can deny a value its organization allows, and it cannot allow a value its organization denies. An OrgPolicy is a limit that no namespace can widen. Priority does not change that: an OrgPolicy with no priority limits every namespace exactly as one at 9000 does.
A group with no block for a governed item gives no answer, and the other group’s answer stands. When neither group has one, the value is allowed.
To let a team use a value your organization denies, change the organization’s policies. A namespace cannot open it for itself.
Priority within one group
Priority orders the OrgPolicies of one organization among themselves, and the Policies of one namespace among themselves. Ringleader never compares an OrgPolicy’s priority with a Policy’s. A policy with no priority counts as 0. Within one group, three rules give the answer:
- The default is the one declared by the highest-priority block that declares any. If two blocks tie at that priority with different defaults, the answer is deny. A tie is an unresolved disagreement, and the restrictive answer is the safe one.
- The verdict comes from the highest priority at which any block matches the value. Only blocks at or above the priority the winning default was declared at count. No match there leaves the default standing.
- A conflict at that priority is a value that matched both an
allowand adeny, in one policy or in two. It goes to the verdict that departs from the group’s default, because an explicit entry exists to be an exception. Withdefault: allowthe deny wins, and withdefault: denythe allow does.
Rule 3 decides how you write an exception to an allow. Under default: deny, a deny of github.com/acme/legacy beside an allow of github.com/acme at the same priority loses, because both match. Put the deny in a policy of the same group at a higher priority instead.
A namespaced Policy’s priority has a cap, and The priority cap says what it is.
Policy authors
| Kind | Written by | Read by |
|---|---|---|
OrgPolicy | an organization administrator, for their own organization | Organization administrators only. It is cluster-scoped, so a namespace member cannot read one even though it governs their applies. |
Policy | a namespace administrator | Members of that namespace |
A policy is a governance fact rather than a personal resource. There is no “my own policy” that an ordinary member can author for themselves. Roles and grants says who holds these roles.
Write a policy
You write an OrgPolicy to set a limit for the whole organization, and a Policy to narrow one namespace. Each names the governed items it limits under rules, as Policy and OrgPolicy describes.
Write an OrgPolicy that allows your own GitHub organization and nothing else. The
default: denyrefuses every repository the lists do not name.apiVersion: core.ringleader.dev/v1 kind: OrgPolicy metadata: name: acme-baseline spec: org: acme priority: 200 rules: gitSources: default: deny allow: - github.com/acme - "*.internal.acme.example"Run
rl apply -f orgpolicy.yaml.Optional: to allow one more repository in every namespace of the organization, write a second OrgPolicy at a higher priority than the first.
apiVersion: core.ringleader.dev/v1 kind: OrgPolicy metadata: name: acme-vendor-sdk spec: org: acme priority: 300 rules: gitSources: allow: - github.com/vendor/sdkOptional: to keep one namespace off a repository the organization allows, write a Policy in that namespace. This one keeps the
paymentsnamespace off the vendor repository.apiVersion: core.ringleader.dev/v1 kind: Policy metadata: name: no-vendor-sdk namespace: payments spec: rules: gitSources: deny: - github.com/vendor/sdk
A namespace can narrow what its organization allows, but it cannot widen it. To list your policies after you apply them, see CLI.
Find out why a request was refused
When an apply is refused, the message names the field and the value. Use it to find the policy that decided.
- Read the message. The field and the value are enough to fix most files.
- List your namespace’s own policies with
rl policy get -n payments, and read one withrl policy describe no-vendor-sdk -n payments. - If no Policy of your namespace explains the refusal, an OrgPolicy you cannot read decided. Ask an organization administrator, who can list OrgPolicies with
rl orgpolicy get, which one it was. - If a repository is refused and no policy of yours mentions it, the deployment itself does not permit that git host. Operator limit on git hosts says why, and the person to ask.
Next steps
- Policy and OrgPolicy: the governed items, the fields and how to write each kind of entry.
- Enforced protections: what a member’s computer enforces for your organization.
- Roles and grants: who is an organization or namespace administrator.