Findings
[P1] Service-token issuance should be constrained to the management-cluster boundary.
This PR adds bearer service tokens that are intentionally cross-account once authorized by policy. Since bearer tokens are portable after minting, OAuth client credentials alone do not prove that the caller is still Atlas, Tuist Server, or even running inside the same management cluster. For defense in depth, both service-token issuance and any API surface that accepts AuthenticatedService should be reachable only through the internal management-cluster path. Concretely, I would keep these routes off the public ingress and enforce the boundary with Kubernetes NetworkPolicy and/or an internal Gateway route. The stronger version is to require workload identity too, for example mTLS/service-mesh identity or a projected Kubernetes service-account JWT with an audience for Tuist Server, so the server verifies the expected namespace/service account in addition to the OAuth token.
[P1] Service detection can diverge from the client Boruta actually authenticated.
TokenGenerator.generate/2 decides to issue a service token with Clients.service_client?(client_id), but Clients.get_client/1 resolves built-in static clients before service clients. If the configured service-client list accidentally reuses the Tuist OAuth client id, Boruta authenticates the Tuist client while the token generator still signs an AuthenticatedService token. That would bypass the intended service-client secret, TTL, and scope configuration. Please either reject duplicate service-client ids at config parsing time or make service-token generation depend on the same resolved client identity/order that Boruta authenticated.
[P2] Service tokens can pass require_authentication and then crash account-owned endpoints.
authenticated_subject_account/1 now returns nil for AuthenticatedService, but several authenticated API paths still assume every authenticated non-user subject has an owning account. For example, OrganizationsController.index/2 preloads authenticated_subject_account(conn) and then dereferences account.organization; a valid service token hitting GET /api/organizations would satisfy authentication and then raise instead of returning a controlled 403/401. Please explicitly reject service subjects on account-required routes, or update those callers to handle nil before dereferencing/storing the account.