Repository navigation
Description
Summary
A pilot tester could create API keys in an organization where they are only a member and hold no grant. They traced it to their account being an Admin in another organization. The rule for holding a personal key is judged per person, not per organization:
mayCreateApiKeys(services/platform/backend/auth/api-key-create-gate.ts:52-81) admits anyone who is an Owner, Admin or Developer in any organization, or who holds a key-using grant (tale:models.api,tale:notifications.export,tale:rest.act-as) in any active seat (truth table at:20-26).- The key "works in every organization you belong to" (
backend/domains/api_keys/spec.md:16) and acts there with the holder's role. - The docs present it differently. A grant "applies in this organization only", and a member gets key creation as part of a grant (
docs/en/platform/admin/governance/competences.md).
So organization B's admins decide through grants who may hold a key, yet a role in organization A overrides that. B's admins also cannot see the resulting key (#5045).
The key cannot do more than the holder's role in B, because every door judges each call. B's model endpoints still need B's switch and B's grant or role (backend/domains/model_api/access.ts). What the key adds in B is programmatic REST and MCP access as that member, which B never granted.
mayConnectAgentIn (api-key-create-gate.ts:92-109), the rule for connecting a coding agent, already judges one organization at a time.
Options (not exhaustive)
- Judge per organization when a key is used. A personal key works in an organization only while its holder may hold a key there: an Owner, Admin or Developer role there, or a key-using grant there. Otherwise the call gets a
403with a reason. Creating a key stays "allowed in at least one organization". - Bind each personal key to the organization it is made in. The right, the listing (APIKEY-R8) and the ending then all live in one organization. This breaks anyone who uses one key across organizations, and needs a migration for existing keys.
- Keep the rule. Explain it in Settings › API: "You can create keys because you are an Admin in A; here the key acts as a Member."
Questions
- Do multi-organization setups, such as separate test and production organizations, rely on one key working across organizations?
- Under option 2, what happens to existing keys that already work in several organizations?
Done when
- An option is chosen, and the APIKEY spec, the create gate, the key authentication and the docs agree with it.
- Tests: a person who is an Admin in A and a Member without a grant in B cannot use a key in B (option 1), or cannot create one there (option 2).
Activity
yannickmonney commentedon Nov 14, 2026
Decision
Option 1: judge each organization when a key is used. A person's own API key works in an organization only while its holder may hold a key there:
Otherwise the call gets
403 API_KEY_NOT_ADMITTED. The answer names the role or competence it takes and lists the organizations where the key still works.This is the rule that connecting a coding agent already applies (
mayConnectAgentIn). It becomes the single rulemayHoldApiKeyIn. Every call is checked at the REST door, which MCP and the model endpoints share.What else changes:
Answers
API_KEY_NOT_ADMITTED. Granting a role or competence there restores the key at once, with no reissue. The release notes will call this out.Rationale
A grant "applies in this organization only", and organization B's admins decide through grants who may hold a key in B. Today a role in another organization overrides that, giving REST and MCP access to B that B never granted.
Checking each call at the one door every key passes through closes this. It reuses the per-organization rule that agent connections and single-sign-on keys already use, and completes the controls shipped for #5045, #5217 and #5218.
Binding each key to one organization (option 2) would break legitimate use across organizations and force a migration. Keeping the rule (option 3) would only document the hole.
Implementation units
mayHoldApiKeyIn; add the check and theAPI_KEY_NOT_ADMITTEDcode inrest/v1.ts, also for single-sign-on keys; filter the "where it works" lists; update the spec (APIKEY-R14) and the docs in en, de and fr; add a manual-test box.GET /meand "All keys in this organization" leave out organizations where the key doesn't work; the block dialog marks such keys "Doesn't work here"; locale strings in every locale.Cross-issue amendments (decisions taken together with #5404, #5218, #4878, #5374, #5136):