Commit Graph

1 Commits

Author SHA1 Message Date
rcourtman
fb4feee411 Keep token management inside the caller's organizations
The API token inventory is global, but only token creation recorded an
organization. Listing, reading, renaming, deleting and rotating a token
looked the target up by ID across every organization and checked scopes
only. A token bound to one organization could therefore see another
organization's tokens, and rotate one to obtain its raw credential,
including an instance-wide full-access token.

A token caller may now manage a token only if every organization the
target is bound to is one the caller is bound to. Instance-wide
full-access tokens keep managing everything, and browser sessions are
unchanged. A target outside the caller's organizations answers 404, as if
it did not exist, and is left out of the list.

An instance-wide full-access token is the most powerful credential, so
only an instance-wide caller may rotate, delete or edit one, or mint one
in the default organization (directly, or by editing a scoped token to
full access); a caller bound to several organizations that
includes the default one is not instance-wide, even though its
organizations are a superset of the target's.

Tests drive each handler as an organization-bound caller and fail when
the matching check is removed.

Contract-Neutral: Behavioural fix that applies the organization binding tokens already carry to token management; no new API surface or contract.
2026-10-11 17:56:38 +01:00