Skip to content

Add typed service-account certificate identity contract - #168

Open
rkoster wants to merge 14 commits into
cloudfoundry:mainfrom
rkoster:service-accounts-poc
Open

rkoster wants to merge 14 commits into
cloudfoundry:mainfrom
rkoster:service-accounts-poc

Conversation

@rkoster

@rkoster rkoster commented Oct 6, 2026 •

Copy link
Copy Markdown

Summary

Community RFC draft: cloudfoundry/community#1645.

Authoritative BBS contract for org-owned service accounts with qualified identities, consumed by companion CAPI and Diego implementations.

  • Add optional CertificateProperties.service_account at protobuf field 2, with ServiceAccount.name at field 1 and ServiceAccount.prefix at field 2; retain existing organizational-unit field 1.
  • Regenerate Go bindings from the authoritative protobuf source.
  • Require canonical lowercase RFC 1123 labels, 3–63 characters, for both account name and organization prefix through certificate properties, desired LRP run-info and task definition validation. Account-free properties remain valid; an account with an empty/missing prefix is invalid.
  • Preserve certificate properties in DesiredLRP.AddRunInfo when assembling stored desired LRPs; without this, the identity is dropped before rep sees it.
  • Cover JSON/protobuf round trips, invalid names/prefixes, boundary labels, account-free LRP/task validation and preservation of both identity fields during stored-LRP assembly.

This is a platform-owned launch identity contract. CAPI owns org-scoped account lifecycle and explicit same-org space entitlements; Diego derives <name>.<prefix>.svc.identity and protects the reserved namespace. Only the final qualified identity model is supported.

Verification and history

Committed TDD cycles:

  • Round trip RED cab068e → GREEN 1b8b954.
  • Canonical validation RED 680b730 → GREEN bd154ac.
  • Stored-LRP assembly RED 1a660ab → GREEN 869b065.
  • Qualified prefix round trip RED 3797482 → GREEN e2b3a2c.
  • Prefix validation RED 105b5b6 → GREEN f974b85.
  • Required prefix/final-model contract RED 29fc9bb → GREEN 7fc64d1.

Focused contract tests and full models regressions passed again on 2026-11-19 after requiring the prefix. Changed Go files are gofmt-clean and git diff --check passes. The schema/generated bindings are unchanged by this validation correction. Diego dependency alignment at fbf2a7ffc verifies LRP/task rejection and qualified wire-to-certificate flow in both vendored and module mode. Earlier live evidence predates this correction; integrated live revalidation remains follow-up work.

# From models/
go test . -run 'TestServiceAccount|TestQualified|TestAssembledDesiredLRP' -count=1
go test ./... -count=1

Compatibility and draft dependency

Optional protobuf additions preserve account-free wire compatibility, but old components may discard unknown fields. Automatic capability negotiation is not implemented; the companion CAPI/Diego operator gates require all participating components to be upgraded before launching account-bound workloads.

Companion Diego at fbf2a7ffc pins code.cloudfoundry.org/bbs/models to v1.15.1-0.20261119082436-7fc64d1d37a1, using an explicit replacement by the same published version of github.com/rkoster/bbs/models with committed checksums. Remove the fork replacement/select the upstream module version after merge and publication. No tags/releases are created by this draft.

Companion drafts: cloud_controller_ng #5520, capi-release #702, Diego #1216, CLI #3875. This contract is experimental and does not itself implement UAA token policy or route authorization.

@rkoster rkoster changed the title Draft: add typed service-account certificate identity contract Add typed service-account certificate identity contract Nov 19, 2026
@rkoster
rkoster marked this pull request as ready for review November 19, 2026 11:52
@rkoster
rkoster requested a review from a team as a code owner November 19, 2026 11:52
Copilot AI balanced review requested due to automatic review settings November 19, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The root models dependency and vendored sources still lack ServiceAccount support, causing the server to discard account identities during request decoding rather than validate and persist them.

1 open issue
1 file not reviewed
  • models/certificate_properties.pb.go: Generated file
What changed in this PR

Adds a typed, organization-qualified service-account identity contract to BBS models for companion CAPI and Diego implementations.

Changes:

  • Adds optional service-account name and prefix fields to the protobuf schema and regenerates Go bindings.
  • Validates both identity fields as lowercase RFC 1123 labels of 3–63 characters, while allowing account-free certificate properties.
  • Preserves certificate properties during desired-LRP assembly and adds round-trip, validation, and identity-preservation tests.
File Description
models/​task.go Validates certificate properties in task definitions.
models/​desired_lrp.go Validates identity labels and preserves certificate properties during LRP assembly.
models/​certificate_properties.proto Defines the optional service-account identity message.
models/​certificate_properties.pb.go Adds generated bindings and serialization for the identity fields.
models/​certificate_properties_test.go Covers serialization, validation boundaries, account-free inputs, and identity preservation.

Review effort: Balanced

Comment thread models/certificate_properties.pb.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the service-account certificate identity changes.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • models/certificate_properties.pb.go: Generated file

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants