Skip to content

Permissions overview

How Forge decides who can do what in an org and its repos, down to single records, with org and repo policies.

Updated

Forge decides who can do what in an org and its repos with policies. A policy can reach every resource: the org itself, its members, groups, and connections, and inside a repo its branches, change requests, schema, extensions, tools, workflows, and single records.

This section is for org admins who decide access, and for developers and agents who write policies:

  • This page explains the model: who policies apply to, how Forge combines them, and what a new org starts with.
  • Writing policies covers the policy language.
  • Recipes holds policies to copy for common needs.
  • Testing a policy shows how to check, simulate, explain, and diff a change before you save it.
  • Action reference lists every action by resource kind.
  • Troubleshooting explains refusals, empty lists, and checker problems.

Owners, members, and groups

Every person or agent in an org is a member, and some members are owners:

  • Owners bypass every policy, in every repo. Because owners always have full access, an org can’t lock itself out. Only an owner makes another member an owner or steps one down, and an org always keeps at least one owner.
  • Members do what the org’s policies allow, and nothing else.
  • Groups are named sets of members, such as Finance, HR, or PMs. A job role is a group. Groups don’t nest, and a policy names a group to apply to everyone in it.

Repos have no members of their own. Who works in a repo is a policy over read on the repo, as Repo access describes.

Org and repo policies

A policy names its principals, who it applies to, and lists statements. Each statement allows or denies some actions on a resource, optionally under a condition. A principal is everyone, a group, a single user, or an extension acting on its own.

Forge has two kinds of policy:

Kind Holds Covers
Org policy Allows and denies Every repo and the org itself, or only the repos that it lists
Repo policy Denies only The one repo that it belongs to

Every policy lives in the org, repo policies included. Policies aren’t part of any repo’s history: a branch, a merge, or a revert never changes who has access. The live policies decide every request, on every branch and every past commit, so revoking access also hides history.

Each change to a policy appends a version and applies from the next request. You can list a policy’s versions, restore an earlier one, and delete a policy, which appends a deletion. See Save and roll back for the commands.

How Forge decides

Forge decides an action inside a repo in two passes, and both must allow it.

The org pass reads the org policies that apply to the user and cover the repo:

  1. Nothing is allowed by default.
  2. Every matching allow adds access, across all of the user’s policies.
  3. Any matching deny wins over every allow.

The repo pass reads the repo’s own policies. It allows everything that no matching repo deny covers. A repo never widens what the org allows. It only narrows it, which is why repo policies hold only denies.

Org pass Repo pass Result
Allow Allow Allowed
Allow Deny Denied, because the repo denies
Deny Allow Denied, because the org denies
Deny Deny Denied

The org’s allows set the upper limit for every repo. Org-level actions, such as adding a member or managing groups, belong to no repo, so only the org pass decides them.

A condition that can’t be evaluated, such as one that compares a missing value, never grants access. In an allow, it grants nothing. In a deny, it matches. See Missing values.

Repo access

Every action inside a repo needs read on the repo itself, and an allow on a model never grants it. To show a repo only to some people, either:

  • Deny read on repo to everyone outside their group, in a repo policy of that repo or in an org policy that lists it. Restrict a repo to a group shows both.
  • Leave the people who see only some repos out of Editors, and allow them read on repo in an org policy that lists their repos. Contractors limited to one repo shows how. A repo that a user can’t read hides everything in it from them, its policies included.

Hidden and forbidden

Forge answers a refused request in one of two ways, so that a request never reveals what a user can’t see:

  • Hidden. When the user can’t read the repo or the record that a request names, Forge answers as if it doesn’t exist: RepoNotFound, CustomRecordNotFound, or PolicyNotFound for a policy of a hidden repo. A non-member of an org, or a member without read on org, gets OrgNotFound.
  • Forbidden. When the user can read the repo or the record but lacks the action, Forge answers 403 Forbidden: Forbidden for an action on the repo, the org, a schema, an extension, or an installation, and RecordWriteDenied for a write to a record.

Lists, searches, counts, and aggregates hold only the records that the user can read, so a hidden record never changes a total or a page.

Records, reads, and writes

Policies decide whole records. A user who can read a record reads all of its fields. To protect some values more tightly than the rest of a record, keep them in a model of their own, such as a project’s financials beside the project.

A user sees a record when some org allow for read matches it and no org or repo deny for read matches it. A write takes three checks:

  1. Read access. For an update or a delete, the user can read the stored record. For a create, the user can read the new record.
  2. An allow. Some org allow for the action matches, with a condition that holds on the record both before and after the write.
  3. No deny. No org or repo deny for the action matches. A deny matches when its condition holds on either side of the write.

When a write cascades or recomputes formulas, every record that the cascade updates or deletes, and every record whose formula the write recomputes, is checked as a write of its own. A merge is its merger’s write of everything that it changes: records, schema, CI checks, tags, extensions, installations, schedules, and agent context.

Default policies

A new org starts with three default groups and three org policies, one policy for each group. You edit them like any other:

Policy Principals What it allows
Editor The Editors group Reading the org, its repos, members, groups, schema, extensions, installations, CI, history, attachments, workflow runs, and agent context. Every action on records, and every repo action except update, manageCi, and managePolicies.
Admin The Admins group Every action, in every repo and on the org.
Viewer The Viewers group What Editor reads, and no writes.

A member gets a policy’s access when they join its group. The founding owner starts in Admins, which they keep if they stop being an owner. Because owners bypass every policy, the groups matter only for the other members. Editor gives each of its members the same access in every repo, so a repo needs no policy of its own until it narrows the org.

The default group

An org has a default group, which is Editors on a new org. A person who becomes a member in no group joins the default group. That covers:

  • a user whom someone adds directly without group_ids;
  • a person who accepts an invite that names no groups, or whose groups are all deleted;
  • a person who comes back after they left or were removed.

Naming groups in the add or the invite replaces the default group. An owner never joins it, because owners bypass every policy. The rule applies only when a person joins, so a member whom you remove from their last group stays in no group. Adding or inviting someone takes inviteMembers, which alone gives the new member the default group’s access. Naming groups also takes manageGroups.

Only an owner changes the default group: PATCH /orgs/:org_id/groups/:group_id (forge groups update-group) with {"is_default": true} makes that group the default group, and {"is_default": false} on the default group leaves the org without one. Each group answers is_default, which is true for the default group. Deleting the default group succeeds and leaves the org without one until an owner sets another.

Under the default policies, a member in no group has no access: the org answers them OrgNotFound, and the site shows “Page not found”, until someone with manageGroups adds them to a group. This happens when a member is removed from their last group, or when a person joins with no groups named while the org has no default group. An org older than the three default groups keeps Editor for every member, and has no default group for new members to join until an owner sets one.

Editor doesn’t allow changing schema, creating, publishing, or installing extensions, calling tools, running workflows, schedules, or triggers, managing agent instructions and skills, or any org action besides reading the org, its repos, its members, and its groups (it doesn’t read policies, connections, billing, or schedule and trigger runs). Each of those takes a policy of its own. The Action reference marks what Editor and Viewer allow, action by action.

Who manages policies

Managing access is itself a set of actions:

  • managePolicies on org changes every policy in the org. readPolicies on org reads them, except the policies of a repo that the reader can’t read. Grant readPolicies alongside managePolicies on org, because managePolicies alone doesn’t grant reading or saving a new version of an existing org policy.
  • managePolicies on repo reads and changes only that repo’s policies. Only an org policy grants it, because repo policies can’t allow. A repo’s policy managers can deny anyone in the repo, themselves included, and an org owner restores what they lock out.
  • manageGroups on org changes who is in each group. Adding someone to a group grants everything that the group’s policies grant, so treat it as you treat managePolicies.

Who a run acts as

Extension code never borrows a person’s authority:

  • A tool call, a workflow run, and an extension’s UI act as the user who called or started them.
  • Work that no person asked for acts as the extension itself: a schedule’s run, a trigger’s run, a webhook delivery, an email delivery, any workflow that one of those starts, and a room handler that runs for no connection, such as onAlarm. That holds when a member presses run too, so an owner who installs an extension or runs its schedule lends it none of their access.
  • A visitor to a public share of an installation’s UI isn’t signed in and acts as the extension’s guest: the extension itself, with less of its built-in access.
  • An MCP client and the CLI act as the user who signed them in.

An extension acting on its own works under a built-in policy in each repo whose main installs or defines it: Editor, plus calling its own tools, running and answering its own workflows, and running its own schedules and triggers. It also calls the tools and runs and answers the workflows of each peer that its package.json declares and that main installs too, so a schedule that looks a company up in a peer’s directory needs no policy. Nobody edits that policy. To narrow it, write a deny whose principal is extension("integrations.procore"), and to grant more, an allow with that principal. In the repo that defines the extension, a commit that changes its code or data publishes it, so a run writes that data there only once an allow grants publish on the extension. Policies for everyone, groups, and users never apply to an extension. Its commits name it as the author, such as “integrations.procore (extension)”.

A public share’s guest works under the same built-in policy with two parts left out: a guest calls no tool, the extension’s own included, and runs and answers no peer’s workflows. No built-in policy lets a guest join a room. To open a tool or a room to guests, save an org policy whose principal is extension("integrations.procore"), with an allow whose condition is request.principal === "guest", as Change what an extension does on its own shows. A workflow that a guest’s tool call starts doesn’t run as the guest. It runs as the extension on its own: a condition reads request.principal === "automation" for its steps, which have the access that the guest lacks.

A policy condition can tell these apart with request.channel and request.principal. See Conditions.

Type to search…

↑↓ navigate↵ selectEsc close