Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Potential foundation-wide entitlement scans and repeated UAA discovery while bind transactions hold locks warrant human assessment of scalability and availability risks.
No open issues 🎉
4 resolved since last review
Review effort: Balanced
Addressed in f2903b3 (RED 58a04f1): added a space-first |
Addressed in e4a087a (RED 2f0f042): broker clients now use shared, synchronized issuer discovery with a five-minute cache instead of constructing a token decoder per bind. Tests cover reuse across clients, concurrent callers, expiry, retry after failure, and refusal to use expired data. Cold/expired discovery still requires a UAA request. Combined migration/discovery/broker/V2 suites pass 216 examples on each of PostgreSQL 17 and MySQL 8.2; changed-file lint passes. Review: #5520 (review). |
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because a critical edge case involving role grants before provisioning can reject unclassified client users, blocking provisioning and retries before the first token is issued.
No open issues 🎉
Review effort: Balanced


Summary
Implement the Cloud Controller portion of Service Accounts for Cloud Foundry Workload Identity (community #1645), aligned with the RFC document at its merged revision.
Service accounts are org-owned identities, shared by apps only in explicitly entitled spaces of the same org. Each org has an admin-allocated, immutable, foundation-unique
service_account_prefix; account names are immutable and unique within that org. Both use lowercase RFC 1123 labels of 3–63 characters.For prefix
acme-paymentsand accountpayments-worker:cf:service-account:acme-payments:payments-workerpayments-worker.acme-payments.svc.identitycf:svc:acme-payments:payments-workerOne app has at most one account; many apps can share an account. Assignment grants no permissions: account use, CAPI roles, external grants and route policies remain explicit and independent.
Intentional RFC divergence: independent CAPI user lifecycle
Unlike RFC Appendix D, first bind provisions only the managed UAA client; it does not create a roleless CAPI user. CAPI users and their role grants remain independently managed. The existing CAPI authentication flow can lazily create a roleless OAuth user on its first API request; explicit roles are still required for resource access. No new explicit-user-creation command or authentication behavior is introduced here.
Disable, enable and service-account retirement do not create, disable or delete CAPI users or their roles, nor do they change external WIF identities/grants. Account deletion removes the managed UAA client and account resource. Ordinary space/org deletion still removes roles on deleted resources. If an identity is explicitly reused, independently retained CAPI roles can apply to the same client ID, just as retained external grants can; remove those grants independently when retiring access. This avoids coupling workload identity lifecycle to CAPI user lifecycle and requires no account-to-principal ownership field.
Proposed RFC amendment: nested attribution
Following Draft RFC amendments #1709, new managed registrations map attribution to
cf.instance_guid,cf.app_guid,cf.space_guidandcf.org_guid, emitted by UAA as one nestedcfobject. The owning-org certificate requirement uses the samecf.org_guidmapping key. Issuer/subject identity and role authorization remain unchanged. Operators configure token lifetime throughcc.service_accounts.token_validity_in_seconds: a positive integer defaulting to 300, with no CAPI-imposed five-minute ceiling. UAA must still enforce certificate expiry and its applicable token-policy limits. Existing managed registrations receive validity-only updates on their next provisioning/enable reconciliation; configuration deployment alone does not immediately update them, and issued tokens are unaffected. Identity/trust/authority drift still fails closed. The amendment is still proposed. Existing flat-claim UAA registrations are not silently rewritten and require deliberate reconciliation/retirement before using the new profile.Cloud Controller implementation
Accounts, namespaces and permissions
/v3/service_accountslifecycle, metadata, filtering, app listing and space-entitlement APIs, plus GET/PATCH/v3/apps/:guid/relationships/service_account.service_account_prefixon creation or one-time unset-to-value update. Allocation is admin-only and atomic; an allocated prefix cannot be renamed, cleared or automatically released on org deletion. An unset prefix prevents account creation, entitlement expansion and assignment.service_accounts.total_service_accountsto org quotas and an optional rolling seven-day creation budget per authenticated user/client across spaces. Admins are exempt from the budget; failed creation rolls back consumption and deletion does not refund it. Concurrent creation and first-bind provisioning are serialized, including MySQL repeatable-read handling.reuse_namecreates a new UUID, is audited, and warns that external grants and still-valid old certificates may apply. Live collisions and quotas remain enforced.Lifecycle, UAA registration and runtime identity
tls_client_certificate_bound_access_tokens: false, configure operator-selected token validity (default 300 seconds), and map nested instance/app/space/org attribution claims. Support the named allowed-resource-policy reference for federation audiences; developers do not control registration inputs.VCAP_SERVICE_ACCOUNT. Snapshot process identity until explicit restart; new runtime tasks use the current assignment; staging excludes account identity.Explicit authorization and integrations
cf:svc:<prefix>:<name>route-policy sources, account resolution and domain org/space restrictions while preserving existing source semantics.{ issuer, subject }to the CF platformcontext.service_accountof broker bind requests for ready accounts; service keys do not receive it. Identity-based bindings must be removed before app reassignment. Existing bindings require rebind to adopt the account. Broker-side shared-grant lifecycle remains the broker's responsibility.Verification
498d40b4c, including normal and backward-compatibility suites on MySQL 8.0/8.2 and PostgreSQL 14/15/17, OpenAPI request conformance, docs, RuboCop, CodeQL and CLA. Main test run · backward compatibility.cnf, named resource-policy audience selection/denials, and policy-only updates without re-registering account clients. These are integration evidence, not proof of every external provider's token requirements.Dependencies, rollout and remaining validation
cc.service_accounts.enabledin BOSH, rendered asservice_accounts_enabledfor API, worker, clock and deployment updater. Deploy compatible UAA/BBS/Diego and routing components before enabling it; there is no numeric contract-version setting. The app-facing token endpoint must support reachable, trusted mTLS, either directly or through UAA's authenticated trusted-proxy mode.azp/audience semantics), broker-managed shared grants end to end, Windows runtime, and namespace-limited UAA client administration. CAPI registration alone does not demonstrate these UAA/provider/broker properties.The RFC document's recorded status is Draft, although community #1645 is merged. This PR implements the CAPI scope and records its cross-component dependencies; it does not claim complete end-to-end RFC acceptance.