Skip to content

Out-of-scope principals answer 404

Accepted.

2026-11-06.

The principal list (GET /api/principals) filters rows by what the caller may see. The by-id reads did not apply the same rule: they checked client access only when the principal had a home client. A principal with none (an anchor user, a global service account, a partner) was answered to any caller holding the view permission. A client administrator could therefore read an anchor user’s name, email and roles by id, although the list hid that user. The leniency had been carried over from an earlier implementation and was not a product decision.

A second problem hides inside the fix. If out-of-scope answers 403 while missing answers 404, the status code reveals which ids exist.

Every by-id read applies the list’s per-row rule, in one function (PrincipalVisible):

  • an anchor caller sees everything;
  • a principal with a home client is visible when the caller can access that client;
  • a principal with no home client is visible only if it is a partner granted access (through client access grants) to a client the caller can access.

A principal that is not visible answers 404 with the code Principal_NOT_FOUND and message Principal not found: <id>, byte-identical to a missing id. This covers GET /api/principals/{id} and its version, roles, application-access and available-applications sub-routes. A caller reading their own principal is exempt on the first two. Writes were already refused for out-of-scope targets and are unchanged.

Good:

  • No cross-tenant disclosure through direct id access.
  • Existence of out-of-scope principals is not revealed by status codes or message text.
  • List and by-id agree, so a UI link copied from one view behaves the same in the other.

Bad:

  • Debugging is harder: a 404 can mean “does not exist” or “not yours”. Audit logs are the place to tell them apart.
  • Callers who relied on reading anchor users by id as a client administrator lose that access.
  • Every new sub-route of a principal must remember to call the shared rule.
Alternative Why not
Return 403 for out-of-scope targets Confirms existence.
Keep the home-client check only The leak described above.
Filter only in the list and rely on id unguessability Ids are typed and sortable; they are not secrets.