Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dd3044f
auth: an identity-provider group can confer platform_admin
zlareb1 Dec 4, 2026
bd3afc6
auth: ask for the groups scope and keep the role through a key outage
zlareb1 Dec 4, 2026
b5d7eee
auth: check the admin group only where the admin list left the role
zlareb1 Dec 4, 2026
9b9eee9
auth: tolerate clock skew on the provider's ID tokens
zlareb1 Dec 4, 2026
2cafd99
auth: keep the admin role through any transport error at the key fetch
zlareb1 Dec 4, 2026
4b883d8
auth: a key rotated in retries the refresh rather than ending the role
zlareb1 Dec 4, 2026
2b7cde4
auth: fetch a sign-in key rotated in at once, retry only outages
zlareb1 Dec 4, 2026
9865e54
test(auth): a sign-in whose discovery or keys are away is retried unc…
zlareb1 Dec 4, 2026
58163b7
docs(sso): keep Keycloak's full group path for the platform-admin group
zlareb1 Dec 4, 2026
8382355
test(auth): seed a verified email so the listed-admin refresh test bites
zlareb1 Dec 4, 2026
cf9e56a
auth: retry an incomplete key read under PyJWT 2.14 too
zlareb1 Dec 4, 2026
9942ac4
auth: require PyJWT 2.15, the version the lock and CI run
zlareb1 Dec 4, 2026
1724f4f
auth: the approval audit rows name the roles a sign-in minted
zlareb1 Dec 4, 2026
3e6a6ce
test(auth): a group admin's connect approval row names the role
zlareb1 Dec 4, 2026
1fc7167
auth: a link page finished after the group setting is cleared grants …
zlareb1 Dec 4, 2026
e95878a
test(auth): name the link-page test for both its cases
zlareb1 Dec 4, 2026
76aada7
auth: a link page grants the group role only for the group still named
zlareb1 Dec 4, 2026
41785d3
docs(settings): a refresh keeps the group role, it never adds it
zlareb1 Dec 5, 2026
830c9ae
auth: treat a key set that is not JSON as a provider outage
zlareb1 Dec 5, 2026
4c43e0b
auth: treat a key set that is not UTF-8 as a provider outage too
zlareb1 Dec 5, 2026
b44b1ce
auth: name the group check's key outage in the refresh retry comment
zlareb1 Dec 5, 2026
f314e73
docs: keep the platform-admin group small, since the role spans every…
zlareb1 Dec 5, 2026
df48e8b
auth: name only the error type when wrapping a key set that is not JSON
zlareb1 Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions docs/architecture/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,19 @@ Each op declares `required_role`.
password account; an email matches only an OIDC-verified sign-in. Self-signup emails are
unverified and never confer a role, and self-signup refuses a listed handle as a name, so
a handle promotes only an account that existed before it was listed. An OAuth refresh
re-derives the role and never promotes. A bot registered `--platform-admin` gets it in
every machine token, as a flat token over every namespace (`_machine_tokens` in
`server/auth/oauth.py`); such a bot names no namespace, tells no agents apart and, as a
trust, matches every claim exactly.
re-derives the role and never promotes.
An OIDC sign-in whose verified ID token lists `LOOM_OIDC_PLATFORM_ADMIN_GROUP` in its
`groups` claim gets the role too (`oidc.in_platform_admin_group`): whoever manages that
group at the provider decides who administers the platform. A refresh keeps a role so
conferred only while the ID token the provider issues with it verifies, names the same
email and still lists the group (`_still_in_admin_group` in `server/auth/oauth.py`); that
ID token is checked without a nonce, since it answers Loom's own back-channel token request.
While discovery or the provider's keys cannot be fetched the refresh answers 503 and puts
its token back, so an outage ends no role; a key the cache lacks is fetched at once
(`oidc.signing_key`), so a key rotation ends none either.
A bot registered `--platform-admin` gets it in every machine token, as a flat token over
every namespace (`_machine_tokens` in `server/auth/oauth.py`); such a bot names no
namespace, tells no agents apart and, as a trust, matches every claim exactly.
Only a person signed in as a platform admin, or an operator on the host, registers one:
`/v1/admin/bots.create` refuses the flag to every service account's token and to a
third-party client's session, so a token holding the role cannot mint itself a lasting
Expand Down Expand Up @@ -303,9 +312,10 @@ namespace, and step 8 has none to read) and the token's own role decides. It ask
`writer`: the op makes a namespace, its caller's admin grant there and an indexing job
that clones, stores and embeds a repository and can run its build code. A sign-in
(password, OIDC, the device grant) and a sign-up (self-signup, agent sign-up) mint
`writer`, or `platform_admin` for a name in `LOOM_PLATFORM_ADMINS`, so any member adds
a repository. A token whose own role is `viewer` does not, and neither does a token
scoped to namespaces (step 1). The ops on an existing index (`code.repo.add_branch`,
`writer`, or `platform_admin` for a name in `LOOM_PLATFORM_ADMINS` or a member of
`LOOM_OIDC_PLATFORM_ADMIN_GROUP`, so any signed-in member adds a repository. A token
whose own role is `viewer` does not, and neither does a token scoped to namespaces
(step 1). The ops on an existing index (`code.repo.add_branch`,
`code.repo.set_access`, `code.repo.set_source`, `code.repo.remove`) ask for `admin` of
its namespace. The server cannot tell a coding agent that runs on a member's token from
the member, so the role keeps an agent from adding a repository only where the agent
Expand Down Expand Up @@ -583,7 +593,8 @@ act for email subjects, which a sign-up name cannot spell, or grant each handle
`LOOM_SELF_SIGNUP_ORG` first ([tokens and grants](../guides/tokens-and-grants.md)).

**OIDC and OAuth.** OIDC login trusts only the configured issuer's discovery, verified
emails and nonce-bound id_tokens, sends PKCE to the provider, and refuses a callback whose
emails and nonce-bound id_tokens (a refresh's ID token, from Loom's own token request,
is checked without one), sends PKCE to the provider, and refuses a callback whose
`iss` names another issuer (RFC 9207). With `LOOM_OAUTH_LOGIN_PROVIDER=oidc` the provider
is the only way in: password sign-in and self-signup are refused, since a local password
would bypass the provider's MFA and outlive a deactivation there.
Expand Down Expand Up @@ -653,7 +664,8 @@ common bearer helper. Health remains public but omits denied or unavailable admi
so provisioning refusal or outage cannot prevent logout or grant read/write authority.

Loom stays the authorization server for every client (the dashboard, `loom login`, MCP
clients); the provider only authenticates the person. The OAuth server:
clients); the provider authenticates the person, and confers nothing but `platform_admin`
through `LOOM_OIDC_PLATFORM_ADMIN_GROUP`. The OAuth server:

- accepts only https, loopback-http or app-scheme redirect URIs;
- binds codes to client, redirect and PKCE S256;
Expand Down
21 changes: 11 additions & 10 deletions docs/concepts/identities-and-namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,19 @@ caller cannot read, and each admitted request is audited. The step-by-step setup
Roles are ordered, and a higher role satisfies every check for a lower one. Each
operation declares the minimum role it needs (`GET /v1/operations` lists it).

| Role | Grants | How it is held |
| ---------------- | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewer` | Read. | Token claim or namespace grant. |
| `writer` | Read, and write memory, knowledge and the other data planes. | Token claim or namespace grant. |
| `admin` | Administer one namespace: grants, configuration, policy, restores, promotion to the shared layer. | Token claim or namespace grant; registering a namespace makes you its admin. |
| `org_admin` | Org-wide views (for example cost without a namespace). | A recognised gate with no in-product assignment path. |
| `platform_admin` | Cross-org operator views. | Conferred at login to the handles and verified emails in `LOOM_PLATFORM_ADMINS`, and to the tokens of a bot registered `--platform-admin`; minted only for a service account, with an expiry. |
| Role | Grants | How it is held |
| ---------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewer` | Read. | Token claim or namespace grant. |
| `writer` | Read, and write memory, knowledge and the other data planes. | Token claim or namespace grant. |
| `admin` | Administer one namespace: grants, configuration, policy, restores, promotion to the shared layer. | Token claim or namespace grant; registering a namespace makes you its admin. |
| `org_admin` | Org-wide views (for example cost without a namespace). | A recognised gate with no in-product assignment path. |
| `platform_admin` | Cross-org operator views. | Conferred at login to the handles and verified emails in `LOOM_PLATFORM_ADMINS` and to members of the IdP group `LOOM_OIDC_PLATFORM_ADMIN_GROUP` names, and to the tokens of a bot registered `--platform-admin`; minted only for a service account, with an expiry. |

Grants carry only `viewer`, `writer` or `admin`, and so do the tokens Loom mints, but for a
`platform_admin` one: org-wide power is an operator decision in configuration or at bot
registration, not something a token can carry away. Code namespaces have readers
(`viewer`) and maintainers (`admin`) and no `writer`.
`platform_admin` one: org-wide power is an operator decision in configuration, in the
identity provider's platform-admin group or at bot registration, not something a token can
carry away. Code namespaces have readers (`viewer`) and maintainers (`admin`) and no
`writer`.

## Who may call what

Expand Down
14 changes: 7 additions & 7 deletions docs/guides/tokens-and-grants.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ Verification accepts only `HS256` and `RS256`; `alg=none` is rejected. The
Roles are ordered; a higher role satisfies every check for a lower one. Each op declares its
`required_role` (`GET /v1/operations`, and the [operations reference](../reference/operations.md)).

| Role | Grants |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewer` | Read. |
| `writer` | Read and write memory, knowledge and the other data planes. |
| `admin` | Administer the namespace: grants, configuration, policy, restore into it. Not org-wide visibility. |
| `org_admin` | Org-wide views (for example `cost.summary` without a namespace). A recognised gate with no in-product assignment path. |
| `platform_admin` | Cross-org operator views. Conferred at login to the handles in `LOOM_PLATFORM_ADMINS`, and to its emails only when an IdP verified them; to every token of a bot registered `--platform-admin`; minted only for a service account, with an expiry. |
| Role | Grants |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewer` | Read. |
| `writer` | Read and write memory, knowledge and the other data planes. |
| `admin` | Administer the namespace: grants, configuration, policy, restore into it. Not org-wide visibility. |
| `org_admin` | Org-wide views (for example `cost.summary` without a namespace). A recognised gate with no in-product assignment path. |
| `platform_admin` | Cross-org operator views. Conferred at login to the handles in `LOOM_PLATFORM_ADMINS`, to its emails only when an IdP verified them, and to members of the IdP group `LOOM_OIDC_PLATFORM_ADMIN_GROUP` names; to every token of a bot registered `--platform-admin`; minted only for a service account, with an expiry. |

Grants carry only `viewer`, `writer` or `admin`, and so do tokens, except a
`platform_admin` one: a bot's ([Bots and CI](../operations/sso.md#bots-and-ci)) or
Expand Down
4 changes: 3 additions & 1 deletion docs/operations/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ back.
| `LOOM_SELF_SIGNUP_ORG` | `dev` | You want signed-up accounts in your own org. |
| `LOOM_DEFAULT_NAMESPACE` | `local` | Renaming the one namespace `single-user` mode serves. Ignored when auth is required. |
| `LOOM_JWT_SECRET` | the checked-in development secret | Always, when auth is on. |
| `LOOM_PLATFORM_ADMINS` | empty | Naming the operators. It is the only path to `platform_admin`. |
| `LOOM_PLATFORM_ADMINS` | empty | Naming the operators. With SSO, `LOOM_OIDC_PLATFORM_ADMIN_GROUP` also confers `platform_admin`. |
| `LOOM_TRUSTED_CALLERS` | empty | In `gateway` mode, a subject may send `X-Loom-On-Behalf-Of` to act for an end user. |

- **`LOOM_JWT_SECRET`** is the root secret: it signs tokens as kid `default` (HS256)
Expand Down Expand Up @@ -344,6 +344,8 @@ back.
does). `loom set-host <handle-or-email>` writes the variable into `.env` (`--append`
extends the list); the person signs in again to pick up the role. Self-signup refuses
a listed handle as a new name, so create the account first, then list its handle.
With SSO, an identity-provider group can confer the role instead
([platform admins](sso.md#platform-admins)).

### Public URL and clients

Expand Down
5 changes: 3 additions & 2 deletions docs/operations/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ environment and `.env`. `loom <command> --help` documents every flag, and the
[CLI reference](../reference/cli.md) lists them all.

Org-wide views (cost across namespaces, `ops.health`) need `ORG_ADMIN` or
`PLATFORM_ADMIN`, which only `LOOM_PLATFORM_ADMINS` grants
([deployment](./deployment.md#required-environment)). The deployment-wide `/v1/admin/*`
`PLATFORM_ADMIN`, which `LOOM_PLATFORM_ADMINS`, `LOOM_OIDC_PLATFORM_ADMIN_GROUP`, a bot
registered `--platform-admin` and `loom mint-token --platform-admin` confer
([roles](../concepts/identities-and-namespaces.md#roles)). The deployment-wide `/v1/admin/*`
routes need `PLATFORM_ADMIN`; `token.mint`, `namespace.adopt` and `claim_release` need
`ORG_ADMIN` in the org they act on. A namespace `admin` reaches none of them.

Expand Down
Loading
Loading