Skip to content

feat(broker): define credential continuity contract - #2217

Merged
jhrozek merged 1 commit into
mainfrom
ext-broker-03-engine-custody
Oct 9, 2026
Merged

jhrozek merged 1 commit into
mainfrom
ext-broker-03-engine-custody

Conversation

@jhrozek

@jhrozek jhrozek commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

A broker that does OAuth for a session holds the provider tokens itself.
The session keeps only an opaque binding, and that binding dies with the
broker process, so after a broker restart the user would have to
authorize again. This adds the broker-internal types that let a broker
find the credentials it already stored and hand back a fresh binding.

This commit is the contract only. Nothing here implements or calls it;
the encrypted storage and the recovery logic come in the following
commits of the series.

Added in internal/mcpbroker:

  • OwnerPartition, WorkloadPartition and ProfileDigest: distinct 32-byte
    types, so one cannot be passed for another. The partitions are
    one-way, role-separated hashes of a verified principal
    (ContinuityOwnerPartition, ContinuityWorkloadPartition). The digest
    covers the non-secret OAuth configuration (ProtectedProfileDigest).
  • ContinuityGuard and CustodyAssertion: what a recovery must match.
  • CredentialCustodyStager, CredentialContinuityAdvertiser,
    CredentialContinuityService and ExpectedBindingAttacher: optional
    broker capabilities.
  • ErrContinuityUnavailable.

Comments in broker.go and connector.go now say "session handle" instead
of "attachment".

The partition and digest encodings are stored by later commits, so their
domain tags carry a version ("/v1"); changing them later needs a
migration. The partitions are unkeyed hashes: they keep the identity out
of stored records but can be recomputed by anyone who can guess it.

Co-Authored-By: mecatl [email protected]

A broker that does OAuth for a session holds the provider tokens itself.
The session keeps only an opaque binding, and that binding dies with the
broker process, so after a broker restart the user would have to
authorize again. This adds the broker-internal types that let a broker
find the credentials it already stored and hand back a fresh binding.

This commit is the contract only. Nothing here implements or calls it;
the encrypted storage and the recovery logic come in the following
commits of the series.

Added in internal/mcpbroker:

- OwnerPartition, WorkloadPartition and ProfileDigest: distinct 32-byte
  types, so one cannot be passed for another. The partitions are
  one-way, role-separated hashes of a verified principal
  (ContinuityOwnerPartition, ContinuityWorkloadPartition). The digest
  covers the non-secret OAuth configuration (ProtectedProfileDigest).
- ContinuityGuard and CustodyAssertion: what a recovery must match.
- CredentialCustodyStager, CredentialContinuityAdvertiser,
  CredentialContinuityService and ExpectedBindingAttacher: optional
  broker capabilities.
- ErrContinuityUnavailable.

Comments in broker.go and connector.go now say "session handle" instead
of "attachment".

The partition and digest encodings are stored by later commits, so their
domain tags carry a version ("/v1"); changing them later needs a
migration. The partitions are unkeyed hashes: they keep the identity out
of stored records but can be recomputed by anyone who can guess it.

Co-Authored-By: mecatl <[email protected]>
@jhrozek
jhrozek merged commit f98c23a into main Oct 9, 2026
34 checks passed
@jhrozek
jhrozek deleted the ext-broker-03-engine-custody branch October 9, 2026 06:54
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 13, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant