The teams screen listed teams that owned vaults, so sharing four servers with two
colleagues meant creating a team, then a vault inside it, then wrapping a key.
Two of those three steps are about a concept nobody arrives wanting. The screen
now lists vaults: naming one creates the membership list that carries it, named
after the vault and owned by you, and members, invitations, roles, hand-over and
key holders all hang off the vault they apply to.
Nothing on the server moved. VaultAccessService still resolves a shared vault
through team_membership and every membership call still names a team id — what
went is the requirement that anybody make one. The split the whole design rests
on is untouched and is still what the screen is built around: adding somebody
authorises the server to serve them, and only a machine holding the key can make
the vault readable. ADR 0009 keeps its decision and gains an addendum recording
which half of it a person is now asked about.
The one place the team resurfaces is a membership list carrying several vaults,
which this screen cannot produce and does not hide: the members section says so,
because "adding somebody here adds them there" is precisely the fact a
vault-shaped screen is in a position to conceal.
Two things left the interface and one arrived. Creating a team is gone, and so is
archiving one — it was only ever possible for a team owning no vaults, and a
screen whose rows are vaults has no row for one, so the button would have been
unreachable or always refused. The endpoint is unchanged and the screen states
the limit instead, since a vault cannot be deleted at all. The exception is a
create whose second call failed: cancelling that form archives the membership
list it left behind, which is a deliberate departure from this client's rule
against tidying up on the user's behalf, made because nothing else can reach it.
What arrived is PUT /api/v1/vaults/{id}. Without it the screen loses its only
editing action, since renaming the team behind a vault is invisible to everybody
who was never shown the team. It is gated on PermissionFlags.Admin — the line
UpdateTeamEndpoint already draws, because a name is what everybody in the vault
sees it called rather than part of its contents — and it renames the owning team
with it when that team carries nothing else, so the row an operator reads and the
name a user says cannot drift apart. The slug never moves, for the reason it does
not move on a team rename. The session edits its cached vault row rather than
replacing it with the response, which deliberately carries no wrapped key.
The host editor now asks which vault a host goes into, beside the name, while
adding and only where there is more than one vault to write to. It is a second
picker rather than the keychain screen's reused, and the two selections are
separate on purpose: that one is a standing preference about where new items go,
this is a field of the host in front of you, and binding both to one selection
would mean a click on the other screen could move a half-typed host. An existing
host is not offered it at all rather than offered it disabled — the two vaults
are encrypted under different keys, so moving an item is a delete and a retype.
That forced a fix worth naming. The group picker was built from the active
vault's groups whatever vault the host was being filed into, so a host put in a
shared vault could be filed under a group only its author can resolve — a
colleague would see it filed under nothing, which is the quietest kind of wrong.
Groups are now kept per vault and the picker follows the vault choice.
Two renames, because the pair they would otherwise have made is a bug farm:
ShellScreen.Vault became Keychain and VaultScreen became KeychainScreen, which is
what the rail has always labelled that screen, leaving Vault for one vault's
contents and Vaults for the vaults themselves. The enum values are unchanged;
NavRail.axaml writes them as x:Static literals.
1536 tests pass, seven more than before. Five are new on the server — the rename
endpoint's success, the team it does and does not take with it, the two refusals
and the empty name — and the client suite gains six and folds four together,
having lost the two about archiving a team.
12 KiB
ADR 0009 — Team access: membership authorises, a grant unlocks
- Status: accepted
- Date: 2026-07-31
- Builds on: ADR 0001
Context
M3 makes vaults shareable. The obvious way to model that is one concept — "access" — with a role attached, and to let the server hand it out. Every hosted competitor works that way, and it is what the imported design drew: a members table with a role column, and a share button beside each item.
This architecture cannot implement that concept, and the interesting part of M3 was working out what it can implement instead.
The server holds ciphertext and no keys. A vault key is 32 random bytes sealed to each member's
X25519 public key (docs/crypto.md §3), and only a client holding the plaintext key can produce a
seal for somebody else. So "give Bob access" decomposes into two operations that live on different
machines and cannot be performed by the same actor:
- deciding that the server will serve Bob this vault's rows, which is a database write; and
- wrapping the vault key to Bob's public key, which needs a client that already holds it.
The schema anticipated this — team, team_membership, vault.team_id and vault_key_grant have
existed since the first migration — but nothing had had to name the split.
Decision
Membership is authorisation. A grant is access. The product says so out loud.
VaultAccessService resolves a team vault through team_membership, mapping the role to
PermissionFlags by a union with no Deny rules. That decides what the server serves and nothing
else. Whether the caller can read what it serves is decided by whether they hold a grant, which the
server records, cannot produce and cannot verify.
Five consequences, each of which is a place where a more reassuring design was rejected:
- A member with no grant is a normal state, not an error.
VaultSummary.WrappedVaultKeyis null and the vault appears in their list saying it is waiting for a key. Hiding it until a grant existed would have been tidier and would have implied the server was the thing granting access. - The roles are only the ones that are enforceable. There is no
ConnectOnly, despite the design asking for one andTeamRolehaving room. SSH terminates on the client, so opening a session needs the credential's plaintext on that machine; "may connect but may not read the key" cannot be enforced here, and shipping it as a role would have been a lie in a dropdown.Connectrides along withReadand is documented as an interface hint. - Sharing verifies the recipient's key against the append-only key log, or refuses. A directory
lookup is a claim by the server about a third party's public key; wrapping to an unverified claim
hands the vault to whoever made it.
KeyLogAuditreads the whole log, checks its hash chain from genesis, and refuses unless the offered key appears in it unchanged. There is no override flag, because a flag that exists gets used on the day the log is briefly unreachable. - Removal is named for what it does. It revokes grants and flags the vault for rekey. It does not claim to reach anything already downloaded, and the interface says the remediation is rotating the credential — the same non-retroactive limit ADR 0001 records.
- Ownership is sole, so handing it over is one write and not a role change. If membership
authorises, the owner's membership is the last authority in the team, and a transfer that stopped
halfway would leave nobody with the standing to finish it — owned twice if the promotion went first,
owned by nobody if the demotion did, and in either case recoverable only by an operator editing the
database. So
POST /teams/{id}/ownerpromotes the recipient and demotes the outgoing owner to admin in one transaction,ChangeRoleAsyncrefusesOwneroutright, and the recipient must already be an active member — handing a team to an id supplied once is the same mistake as adding somebody straight to the owner role. Demoting rather than removing is the deliberate half: removing them would revoke their vault key grants and flag every team vault for rekey, which is a far larger act than the one being asked for, and somebody handing over a team is usually staying in it.
One thing is deliberately not built, and it is a refusal rather than an omission:
- The rekey itself. Only a client holding the current vault key can re-wrap every item's data key under a new one. The server records that a rotation is owed and the interface reports it. M5.
Two smaller choices, recorded because the alternative was written down first and rejected:
- No
v_user_vault_permissionview. ADR-adjacent notes and the oldVaultAccessServiceremark both anticipated one. The rules turned out to be about sixteen lines of C# shared by the two methods that need them; a view would have moved the authorisation model into migrations, where a test cannot reach it without a container. - Host key trust stays vault-scoped to the personal vault. Pins in a team vault are listed but
not consulted at connect time. Consulting them would let any member with Write pre-approve a
fingerprint that another member's client then trusts silently for a host in their own vault,
which is a cross-boundary trust escalation. Scoping trust properly needs a scope on the SSH connect
path (
IKnownHostStore.FindAsynctakes host, port and algorithm and knows nothing about vaults); until that exists, the safe direction is the narrow one, and the cost — approving a team host's key once per member per machine — is stated in the README rather than hidden.
An invitation is membership decided before there is an account to hold it
A membership names an account: team_membership.user_id is not nullable and carries a foreign key, so
somebody who has never signed in here has nothing for that row to point at. MembershipStatus.Invited
has existed since the first migration and is still never written — not as an oversight, but because a
membership waiting for a person is the one shape this model cannot store. An invitation is therefore its
own record, team_invitation, held against an address, and it becomes an ordinary active membership
the moment an account with that address signs in.
That extends the model rather than bending it. An invitation grants nothing readable and cannot be a step towards sharing, because there is no account and so no public key to wrap a vault to. It moves the first half of the split earlier and leaves the second half exactly where it was.
Three decisions inside it belong here, because each had a more convenient alternative:
- The claim requires
email_verifiedon the access token, and nothing relaxes it. This is the whole of the security boundary. Membership is authorisation, so an invitation that could be taken by anybody able to obtain a token asserting somebody else's address is a way into a team — the same attackOidcOptions.AllowEmailLinkingexists to refuse, arriving by another door and deserving the same bar. An unverified or absent claim claims nothing and logs a warning, which is the only signal an operator gets that their provider is not sending it. There is deliberately no setting to trust an unverified address: a flag that exists is a flag somebody turns on for the afternoon their provider is misconfigured, and this is the one it must not be possible to turn on. - Nothing is sent, and the product says so rather than implying a mail path it has not got. There is no token and no link — the row is a standing instruction, and telling the invitee to go and sign in happens over a channel this server does not carry. A link nobody can deliver would be worse than none. The compensation, such as it is, is real: an invitation that is not a bearer credential is one that cannot be forwarded, intercepted or replayed.
- An address that already has an account here is accepted rather than refused. Refusing and pointing at the directory would have been tidier, and would have turned the endpoint into an oracle for which addresses have accounts on this deployment, answerable by anybody willing to create a team first. Only an address already belonging to a member of this team is refused, and that is a fact the caller can already read off the members table, so naming it leaks nothing.
Addendum: the vault is what the product shows, and the team is behind it
The model above is unchanged. What changed afterwards is which half of it a person is asked about.
The first interface built on this ADR made the team the subject: you created a team, then a vault in it,
then wrapped a key. Two of those three steps are about a concept nobody arrives wanting. So the screen now
lists vaults, and naming one creates the membership list that carries it — named after the vault,
owned by the creator, one per vault. Nothing on the server moved: VaultAccessService still resolves a
shared vault through team_membership, every membership call still names a team id, and the split this
ADR is about — membership authorises, a grant unlocks — is still what the screen is built around, now
stated per vault rather than per team.
Three consequences of the change belong here:
- A team owning several vaults is still legal and is no longer produced. The client cannot make one; an operator or a pre-existing deployment can. The screen refuses to hide it: a vault whose membership list carries others says so, because on a vault-shaped screen "adding somebody here adds them there" is precisely the fact that would otherwise be invisible.
- Archiving left the interface. It was only ever possible for a team owning no vaults, and a screen whose rows are vaults has no row for one — so the button would have been unreachable or always refused. The endpoint is unchanged and the screen states the limit instead. The one place a vault-less team can still appear is a create whose second call failed; cancelling that form archives it, which is a deliberate exception to this client's rule against tidying up on the user's behalf, made because nothing else can reach it.
- A vault can be renamed, which it could not before:
PUT /api/v1/vaults/{id}requiresPermissionFlags.Admin— the lineUpdateTeamEndpointalready draws, because a name is what everybody in the vault sees it called rather than part of its contents. It renames the owning team with it when that team carries nothing else, so the row an operator reads and the name a user says do not drift apart. The slug never moves, for the reason it never moves on a team rename.
Consequences
The sharing graph is visible to the operator: who is in which team, which vaults exist, and who holds
a grant are all plaintext rows. That was already true of metadata generally (docs/crypto.md §10)
and is not made worse here, but it is now a graph rather than a list. Invitations widen it by one
edge — an address that has been invited is on the graph before its owner has ever been here — which is
the same class of fact and worth naming rather than leaving to be noticed.
A malicious granter can seal garbage. The recipient detects it as a tag failure and the grant's Ed25519 signature names who issued it — detectable and attributable, which is the most that is achievable without the server holding a key.
The two-step model costs a step in the interface and buys the property the whole product is for. It also makes a class of bug impossible: there is no code path on the server that could accidentally grant read access to plaintext, because there is no plaintext on the server to grant.