Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
47210f6
grants: invite a person to a namespace by handle or email, with a sin…
zlareb1 Dec 4, 2026
15c46f0
grants: accept an invitation from Namespaces in your org; SDKs, refer…
zlareb1 Dec 4, 2026
a795273
dashboard: invitation result and open invitations components
zlareb1 Dec 4, 2026
d701590
docs: list namespace_invites with the identity tables of the Postgres…
zlareb1 Dec 4, 2026
a81aa67
grants: limit invitation emails per inviter and per address
zlareb1 Dec 4, 2026
4bfde3d
settings: an invitation link's lifetime and the mail server timeout
zlareb1 Dec 4, 2026
08cc874
docs: invitations in the tokens and grants guide
zlareb1 Dec 4, 2026
2cd6ce7
dashboard: route a person's handle or email through grants.invite
zlareb1 Dec 4, 2026
4e9efe3
dashboard: an accepted collection invitation opens the collection in …
zlareb1 Dec 4, 2026
f453aa8
settings: pin the invitation and mail defaults
zlareb1 Dec 4, 2026
55c4b6a
test(dashboard): an accepted invitation reads list_mine again at once
zlareb1 Dec 4, 2026
60de11d
dashboard: the add field's help and the docs say what an invitation b…
zlareb1 Dec 4, 2026
ee00959
grants: keep the downgrade refusal's role as a field; SDK surface sna…
zlareb1 Dec 4, 2026
8fc527d
grants: an open invitation keeps its name in use
zlareb1 Dec 4, 2026
503539f
grants: audit an acceptance without its secret; test the SMTP transpo…
zlareb1 Dec 4, 2026
ddc8816
grants: an invitation never outlasts its maker's admin, nor admits a …
zlareb1 Dec 4, 2026
9c6b8b6
docs, dashboard: invitations as they now work
zlareb1 Dec 4, 2026
2932ef5
grants: invitations stand on the maker's admin grant at both ends
zlareb1 Dec 4, 2026
d913e99
docs: regenerate the grants reference
zlareb1 Dec 4, 2026
0df12b8
grants: an email is held only through a verified tie
zlareb1 Dec 5, 2026
672d202
grants: a link stands only while its maker would authorize a token
zlareb1 Dec 5, 2026
6660cd9
Merge origin/main into feat/namespace-invites
zlareb1 Dec 5, 2026
ffc3529
Merge origin/main into feat/namespace-invites
zlareb1 Dec 5, 2026
b55e8cb
Read the reopen's grant with sequential consistency, and keep the lin…
zlareb1 Dec 5, 2026
84ac002
Reopen a link after a cancelled or lost accept, and list only links t…
zlareb1 Dec 5, 2026
bfea13a
Stop an end user's links with their revocation, and name the gateway …
zlareb1 Dec 5, 2026
431729a
Merge origin/main into feat/namespace-invites
zlareb1 Dec 5, 2026
62c596f
Close a link a cancel meets mid-accept, and test the accept's own guards
zlareb1 Dec 5, 2026
9b1bb52
Merge origin/main into feat/namespace-invites
zlareb1 Dec 5, 2026
8d6d9e8
grants.invite: keep pasted and storage-refused links; cover invites i…
zlareb1 Dec 5, 2026
f2dd8af
grants.invite: let a second pasted link be accepted; leave a set-asid…
zlareb1 Dec 5, 2026
3a957c4
grants.invite: keep a link pasted during another's accept; say when t…
zlareb1 Dec 5, 2026
437afe3
Merge remote-tracking branch 'origin/main' into feat/namespace-invites
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
16 changes: 16 additions & 0 deletions docs/architecture/rolling-upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,22 @@ See the [participant lifecycle baseline](cells.md#participant-lifecycle-baseline
`tests/unit/test_ledger_invariants.py` check N's side, and the mixed-version gate
does not check this rule.

79. **Namespace invitations** (`loom.namespace_invites`, migration
`123_namespace_invites.sql`): N-1 serves none of `grants.invite`, `grants.list_invites`,
`grants.cancel_invite` and `grants.accept_invite`, and answers one routed to it as an
unknown operation. N's dashboard sends a person's add to `grants.invite`, so while N-1
serves, an add or an acceptance can fail on an N-1 replica and succeed on a retry that
reaches N. N-1's in-use check of a new name does not count an open invitation: a name
retired with one outstanding can be registered as new on an N-1 replica, and the link
would then grant on the new owner's namespace; cancel open invitations before retiring
a name during the rollout. N-1's user erasure does not take the user off the
invitations they made: one an N-1 replica runs leaves their `user:<id>` as an
invitation's `created_by` until the TTL drops the row, a week after the link expires.
Those links admit nobody, since the erasure revoked the user's grants, and the
erasure's residue check does not count the table. After a rollback the table stays,
its rows dropped by TTL a week after they expire. No gate holds the rollout, and the
mixed-version gate does not check this rule.

## What checks them

`scripts/gates/mixed_version.py` (`make test-mixed-version`, the `mixed-version` CI job,
Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,8 @@ made while another change to that account runs answers 409 `SIGNUP_IN_PROGRESS`,
says only that a change is running. In use means a `loom.namespaces` row, a configured
code-plane repository or tracker namespace, any row in a table the erasure census counts
by namespace (`census.namespace_tables`), tombstoned or not, a live row in a table whose
rows a later owner would inherit (`namespace_census.STATE_TABLES`: grants, webhooks, task
inboxes, sources and the like), or, on the Postgres authority, a memory there
rows a later owner would inherit (`namespace_census.STATE_TABLES`: grants, open invitations,
webhooks, task inboxes, sources and the like), or, on the Postgres authority, a memory there
(`steps_pg.pg_holds_namespace`). Every other table keyed by namespace is exempt with a
reason (`tests/unit/test_in_use_coverage.py`), which a new table cannot skip. A namespace
can hold such rows without a registry row when auto-registration failed or was off, for
Expand Down
119 changes: 103 additions & 16 deletions docs/architecture/sharing.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,78 @@ admin. The group lands in that org; a member is a user id, held as `user:<id>`.
Membership is read by Loom on every request, never claimed by a token, so removing a
member takes effect within the consistency window below.

## Invitations

`grants.invite` gives a person a role by what an admin knows of them. An email verified
for an account (an SSO account or an `sso_links` row) is granted at once through
`grants.create`, under that account's handle. So is a login handle an account's row is
owned under, or a live grant in the org is stored under (a person whose tokens Loom did
not mint at sign-in has no account row), under the spelling stored for it. Only a
verified tie counts for an email: a row's `owner_email` and a grant's subject are
whatever their writer typed, and `namespace.register` takes any owner. A request with no
token, which only a server with auth off serves, grants every person as typed: no one
signs in there to accept a link. Any other email, one plain address as sign-up checks
it (a dot-atom local part and a domain IDNA encodes, so no list, display name or
comment), gets an invitation: a `loom.namespace_invites` row and the link
`/spaces#invite=<secret>&org=…&namespace=…`. The link is the credential. Only the secret's
SHA-256 is stored, as the row's `invite_id`, and the link works once, for seven days by
default (`invite_ttl_seconds`). The server emails it when `smtp_url`, `mail_from` and
`public_base_url` are set; otherwise, or when the send fails, the answer carries the link
for the admin to pass on. An invitation is made only on an active namespace, where its
link can be accepted. A handle no account holds is refused with 404, so a typo is never
kept as a grant for whoever signs up under that handle later.

Where sign-in is single sign-on only (`oauth_login_provider = "oidc"`), the identity
provider verifies every account's email, so an email no account holds is granted as typed
through `grants.create` instead, and reaches that person at their first sign-in. There is
no link to pass on.

For a person whose tokens Loom does not mint at sign-in (an upstream gateway's,
`loom mint-token`'s, or a trusted caller's on their behalf), an email gets a link too,
accepted by whoever opens it signed in, and a handle Loom has not seen yet is refused.
`grants.create` grants either as typed, for a subject the token's minter names. The
`gateway` identity provider does not mark such a server: a password server with sign-up
off infers it too, and there a grant by email would reach nobody.

The server's mail is no relay for a namespace admin, whom any sign-up can make: it emails
at most 20 invitations an hour per inviter and 3 a day per address, counted in
`loom.auth_attempts` across the deployment (`server.auth.attempts`). Past either limit
the invitation is still made, and its link is the inviter's to pass on.

`grants.accept_invite` gives the invitation's role to the signed-in caller, under the
handle they sign in with, stamped `granted_by` the invitation's maker. Only a person's
token accepts: a service account, a grant principal or a token of another org is refused.
Under a lease per invitation (`grant_claims.invite_change`) it checks that the link is
open, the namespace active and the maker still an admin, and marks the invitation
accepted. It grants after leaving the lease, so the grant's own claims, and an admin
grant's fan-out to a repository's branches, are never taken under it. One link never
admits two people: after a failed grant the link opens again only when no grant at or
above its role stands, so a failure after the grant row landed (a lost reply, a step after
the write) leaves it used. A higher role the caller holds already stands.

An invitation never outlasts its maker's admin. Its maker is the account the admin
rests on: the caller, or a delegated token's creator, whose live grant holds the token to
it. `grants.invite` and `grants.accept_invite` both read that account's grants as the gate
reads them (`authz.subject_grant_role`): on a collection its own, its groups' and
everyone's, there or on a collection above; elsewhere its grant, or an inheriting service
account's creator's. The maker's account must also be active and their subject not
revoked, as for a token they delegated (`delegation.creator_account_active`,
`revocation.is_revoked` at the time the link was made). Short of any of these, the link is
not made, or admits nobody; a failed read answers 503, so the dashboard keeps the link. An
admin whose token alone makes them one (a platform admin, an operator's token) holds no
grant that a later read could tell from a revoked one, so they cannot make a link: an
admin through a grant invites the person. The open invitations name each maker.

Self sign-up makes accounts in `self_signup_org` only. On a password server, a link to a
namespace of another org is accepted by an account an operator made there.

A password account's email is never verified, which is why an email reaches one only
through an invitation: the link went to that address, and opening it proves the reader
got it. The whole link is a fragment, which a browser never sends to a server or puts in a
Referer. Namespaces in your org moves it out of the address into the tab's session
storage, where it waits until the person accepts it or closes the card, or the server
refuses it; where the browser refuses that storage, the card holds it until the page goes.

## Consistency

Every change to a grant, a group or the tree writes a row to `loom.acl_versions` for its
Expand Down Expand Up @@ -282,22 +354,25 @@ replaced, so none reads as live again. It deletes their uploaded originals that
writer's live document shares (each upload by an end user is recorded in
`loom.blob_uploads`, because the document version that named it may have been replaced and
merged away since), revokes and then deletes every grant naming `user:<id>`, blanks their
id as the issuer of the grants they gave others (those grants stay), removes them from
every group, blanks their id as the creator of the collections they made (the collections
stay), and retires their personal collection's directory row (`namespace.delete` and
`collection.delete` refuse a personal collection: it goes only with its user's erasure).
The request ledger keeps the user's calls for cost with their `user:<id>` subject
scrubbed, and the user's newest-call row is deleted. Deleting a SCIM group revokes the
grants that named it, so a group made later under the same id starts with none.
Collections that hold other writers' documents stay: Loom deletes only what its writer
asked to delete. `collection.delete` purges what its collection held (a namespace erasure
that takes the rows off disk) before the collection leaves the tree. A user-scope
`erasure.export` returns the chunks and the conversation rows (transcript turns, saved
messages and threads) that user owns in the collections its caller may read, and in the
user's own personal collection. An org admin may erase a collection's rows without
reading them; a platform admin sees every collection. Each section's read leaves out what
the caller may not see before its limit, so a hidden row never takes a visible row's place
on the page.
id as the issuer of the grants they gave others (those grants stay) and as the maker of
their invitations, closing the open ones, removes them from every group, blanks their id
as the creator of the collections they made (the collections stay), and retires their
personal collection's directory row (`namespace.delete` and `collection.delete` refuse a
personal collection: it goes only with its user's erasure). An accept or an invitation
already past its maker check as that step runs can still write their id, as a grant's
issuer or an invitation's maker, as a `grants.create` in flight can; such a link admits
nobody, since the step revokes the user's grants first. The request ledger keeps the
user's calls for cost with their `user:<id>` subject scrubbed, and the user's newest-call
row is deleted. Deleting a SCIM group revokes the grants that named it, so a group made
later under the same id starts with none. Collections that hold other writers' documents
stay: Loom deletes only what its writer asked to delete. `collection.delete` purges what
its collection held (a namespace erasure that takes the rows off disk) before the
collection leaves the tree. A user-scope `erasure.export` returns the chunks and the
conversation rows (transcript turns, saved messages and threads) that user owns in the
collections its caller may read, and in the user's own personal collection. An org admin
may erase a collection's rows without reading them; a platform admin sees every
collection. Each section's read leaves out what the caller may not see before its limit,
so a hidden row never takes a visible row's place on the page.

## Namespace guides

Expand Down Expand Up @@ -370,6 +445,18 @@ One text serves agents and people, so there is no second copy to drift.
principals and differs per user; no one sort order clusters every user's union.
- **Group membership in a token claim.** A claim is fixed until the token expires, so a
removed member keeps access for the token's life.
- **A confirmation email for every password account.** Verified emails would let a grant
by email bind at sign-in, but every server would need mail to sign anyone up; an
invitation works with or without mail.
- **A pending grant by email, bound at the first sign-in under that email.** A password
sign-up names any email it likes, so whoever registered the address first would take
the grant.
- **The invitation's secret in the query string.** It would reach access logs and Referer
headers.
- **Binding acceptance to the invited address.** A password account has no verified email
to compare, so only the link can prove the address was reached.
- **Cancelling a maker's invitations when their grant is revoked.** A best-effort cascade
would leave a link open when it fails; reading the grant at acceptance fails closed.
- **Inheritance resolved at write time.** Moving a collection would rewrite the grants of
every descendant; resolving at check time from a cached tree costs a walk of at most
eight parents.
Expand Down
Loading
Loading