Skip to content

SPIFFE Broker API & Endpoint - #340

Merged
arndt-s merged 38 commits into
spiffe:mainfrom
arndt-s:arndt/add-broker
Jun 16, 2026
Merged

arndt-s merged 38 commits into
spiffe:mainfrom
arndt-s:arndt/add-broker

Conversation

@arndt-s

@arndt-s arndt-s commented May 28, 2025 •

Copy link
Copy Markdown
Member

This PR adds a SPIFFE Broker API and Endpoint to the SPIFFE specification.

See Google doc for design (proto is a bit outdated in it but it gives the idea)

Resolves #313.

Comment thread standards/SPIFFE_Broker_API.md Resolved
Comment thread standards/SPIFFE_Broker_API.md Resolved
Comment thread standards/SPIFFE_Broker_API.md Resolved
Comment thread standards/SPIFFE_Broker_API.md Resolved
Comment thread standards/SPIFFE_Broker_Endpoint.md Resolved
Comment thread standards/SPIFFE_Broker_Endpoint.md Resolved
Comment thread standards/brokerapi.proto Resolved
Comment thread standards/brokerapi.proto Resolved
Comment thread standards/brokerapi.proto Resolved
@kfox1111

Copy link
Copy Markdown
Contributor

looking really good. :)

Comment thread standards/SPIFFE_Broker_API.md Resolved
@apexlnc

apexlnc commented Oct 15, 2025

Copy link
Copy Markdown

are there plans to continue work on this proposal? with istio ambient mode reaching GA, spire support is needed.

istio/istio#42339 (comment)

@arndt-s

arndt-s commented Oct 15, 2025

Copy link
Copy Markdown
Member Author

Hi @apexlnc,

this topic was discussed at the Istio spec call last week. The Istio community has yet to decide if they want to support a SPIFFE API at ztunnel or other flavors such as Envoy xDS. Until this decision is made this work here is put on hold.

Feel free to join today and express your opinion in this topic.

@kfox1111

Copy link
Copy Markdown
Contributor
  1. There are some of us that are avoiding using istio (ambient) right now because it does not support spiffe. So they really should take that into consideration.
  2. I think we should have this functionality here, regardless if istio will support it or not.

@arndt-s

arndt-s commented Oct 15, 2025 •

Copy link
Copy Markdown
Member Author

@kfox1111 I'm not a bit hesitant adding this API into the standard if we have no client in sight that's picking it up. (In case Istio decides against it)

@strideynet

Copy link
Copy Markdown
Contributor

I agree with Arndt's sentiment here - if we don't have a clear adopter in mind, I would be hesitant to introduce the new specification. It'll be difficult for us to validate the specification is fit for purpose.

@kfox1111

Copy link
Copy Markdown
Contributor

I'd use it for making spire-ha-agent -> spiffe-ha-agent.

There's also a chicken and the egg issue around it. We may never get users if we dont produce it in the first place. As is, istio ambient has been delaying as "we dont have spiffe support" If we had it, then it would shine light on the issue and prevent that from being used as a reason for not supporting it.

@strideynet

Copy link
Copy Markdown
Contributor

I'd use it for making spire-ha-agent -> spiffe-ha-agent.

Is there some documentation/design somewhere for this? It'd be great to explore this in SIG-Spec

@kfox1111

Copy link
Copy Markdown
Contributor

Comment thread standards/brokerapi.proto Resolved
Comment thread standards/brokerapi.proto Resolved
@Jeansen

Jeansen commented Oct 23, 2025

Copy link
Copy Markdown

I'd use it for making spire-ha-agent -> spiffe-ha-agent.

There's also a chicken and the egg issue around it. We may never get users if we dont produce it in the first place. As is, istio ambient has been delaying as "we dont have spiffe support" If we had it, then it would shine light on the issue and prevent that from being used as a reason for not supporting it.

I agree. We already use SPIRE with Istio's sidecar mode. I am eager to replace the sidecars with ambient ... but without the SPIRE/SPIFFE support, that is actually the only pain point why we did not migrate to ambient ;-(

@kfox1111

Copy link
Copy Markdown
Contributor

Same. I'm hesitant to deploy ambient without spire support too.

@Jeansen

Jeansen commented Oct 23, 2025

Copy link
Copy Markdown

@arndt-s
arndt-s force-pushed the arndt/add-broker branch 2 times, most recently from 06c5dd2 to 971bd60 Compare June 15, 2026 09:14
arndt-s and others added 2 commits June 15, 2026 11:19
Co-authored-by: Noah Stride <[email protected]>
Signed-off-by: arndt-s <[email protected]>
Signed-off-by: arndt-s <[email protected]>
@arndt-s
arndt-s force-pushed the arndt/add-broker branch from 971bd60 to 3d32e1b Compare June 15, 2026 09:19
@arndt-s
arndt-s requested a review from strideynet June 15, 2026 09:20
Comment thread standards/SPIFFE_Broker_API.md Resolved
Comment thread standards/SPIFFE_Broker_API.md Outdated

Some references — such as the process ID — are only meaningful and discoverable on the local node. Clients MUST ensure that local references are not sent to remote Broker API servers, and deployments MUST ensure servers do not receive requests originating from outside the node they run on. This mitigates situations where a Broker requests credentials with a process ID from a different node, where that process ID is used by a different workload.

Object references (such as `KubernetesObjectReference`) are valid across the control plane that owns the referenced object — for example, anywhere within the same Kubernetes cluster — and MAY be sent across the network within that scope. Object references MUST NOT be honored by a server bound to a different control plane (e.g., a different cluster); servers MUST reject object references that name a control plane they do not serve.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The KubernetesObjectReference does not have a field that names the control plane. Should it get an optional cluster?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My understanding is that the server itself is bound to a dedicated Kubernetes control plane and that the relationship is always 1-1. Maybe that's too much inferring existing SPIFFE architectures but I'm ensure if there's value to open up the Broker API being able to issue credentials from multiple Kubernetes clusters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but here we are asking the server to not honour those requests that are not within its control plane, but offer no way for it to differentiate. I agree that it's unlikely to be an issue in practice, but having something in the reference, which in the case of k8s would likely be the cluster, would help.

Happy to also defer this for a later discussions, since I don't think it's that big of an impediment, and I don't think it's worth delaying the spec for it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think we can directly defer because, as you're pointing out, there's no name

servers MUST reject object references that name a control plane they do not serve.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed with d0d62c1

Comment thread standards/SPIFFE_Broker_API.md Outdated
Comment on lines +283 to +285
Server and client MUST ensure that no operations are performed beyond the lifetime of the workload. Once the workload has stopped, the server MUST stop sending responses for that workload, and the client MUST drop all data it received for the workload, removing it from file systems or other locations where it may have been stored.

What constitutes "stopped" depends on the reference type. For local references (such as a process ID), the workload is considered stopped when the underlying process terminates. For object references (such as a `KubernetesObjectReference`), the workload is considered stopped when the referenced object no longer exists in the control plane, or — when the reference pinned a UID alongside a name — when the object resolved by name no longer matches the pinned UID.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note for SPIRE (and possibly other implementations), this means that workloads may need to be re-attested at least periodically.

I don't know if we want to relax this requirement a bit, does this mean that we would have to watch these resources?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think that relaxing the MUST to a SHOULD would decrease security by quite a bit. How do you feel if we add some classifier like in a timely manner? It would give SPIRE and other implementation some leeway to prioritize scale & resiliency and not re-attest at every request?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That sounds good to me. I think the client (i.e. broker) should try to respond to this quickly and stop the stream, but the server can also do its own check.

For example in SPIRE I think a natural way of doing this is re-triggering attestation every time an updated SVID would be sent to the workload. I don't think we need to have that in the current PR for it, we can see later how we want to handle it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How do you feel if we add some classifier like in a timely manner?

That makes sense to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread standards/SPIFFE_Broker_API.md Resolved
@arndt-s
arndt-s force-pushed the arndt/add-broker branch from 4a1882b to 97a5576 Compare June 15, 2026 14:49
… be only be used with a single CP

Signed-off-by: arndt-s <[email protected]>
@arndt-s
arndt-s force-pushed the arndt/add-broker branch from 8c34b19 to d0d62c1 Compare June 15, 2026 15:20
@arndt-s
arndt-s requested a review from sorindumitru June 16, 2026 09:51
@arndt-s
arndt-s merged commit 69464c3 into spiffe:main Jun 16, 2026
1 check passed
@arndt-s
arndt-s deleted the arndt/add-broker branch June 16, 2026 10:35
@matheuscscp

Copy link
Copy Markdown
Contributor

🚀 !

MarcosDY pushed a commit to MarcosDY/go-spiffe that referenced this pull request Jun 17, 2026
Supersedes: spiffe/spire-api-sdk#92
spiffe/spire-api-sdk#96

SPIFFE PRs: spiffe/spiffe#340
arndt-s/spiffe#1
SPIRE PR: spiffe/spire#6915

Hey @arndt-s, @sorindumitru suggested adding this directly here instead
of `spire-api-sdk` since this comes directly from SPIFFE and not SPIRE.

Signed-off-by: Matheus Pimenta <[email protected]>
nddq added a commit to nddq/rust-spiffe that referenced this pull request Oct 1, 2026
Add an experimental `broker-api` feature with bindings for the SPIFFE
Broker API (spiffe/spiffe#340):

- the generated `spiffe.broker` client and messages, under
  `broker_api::pb::spiffe::broker`, with a redacted `Debug` for the
  SVID messages
- an `add_security_header` interceptor for the required
  `broker.spiffe.io: true` metadata
- `From` conversions that pack PID and Kubernetes object references
  into a `WorkloadReference` with the full type URL

`cargo run -p xtask -- gen spiffe` also generates these bindings. The
README, CHANGELOG, and Makefile feature lanes cover the new feature.

Signed-off-by: Quang Nguyen <[email protected]>
nddq added a commit to nddq/rust-spiffe that referenced this pull request Oct 1, 2026
Add an experimental `broker-api` feature with bindings for the SPIFFE
Broker API (spiffe/spiffe#340):

- the generated `spiffe.broker` client and messages, under
  `broker_api::pb::spiffe::broker`. The client has no plaintext
  `connect`, because the Broker Endpoint requires mTLS.
- `SecurityHeader`, an interceptor that adds the required
  `broker.spiffe.io: true` metadata. Like the Workload API interceptor,
  it runs an optional custom interceptor first, so that interceptor
  cannot remove or overwrite the header.
- `From` conversions that pack PID and Kubernetes object references
  into a `WorkloadReference` with the full type URL.
- a `Debug` for the SVID messages that shows only the length of the
  private key or token, like `PrivateKey` and the JWT `Token`.

`cargo run -p xtask -- gen spiffe` also generates these bindings,
without tonic transport code. The Workload API and spire-api output
does not change. The README, CHANGELOG, crate summary and description,
and the Makefile feature and MSRV lanes cover the new feature. The
README states that semver guarantees do not cover it.

Signed-off-by: Quang Nguyen <[email protected]>
nddq added a commit to nddq/rust-spiffe that referenced this pull request Oct 2, 2026
Add an experimental `broker-api` feature with bindings for the SPIFFE
Broker API (spiffe/spiffe#340):

- the generated `spiffe.broker` client and messages, under
  `broker_api::pb::spiffe::broker`. The client has no plaintext
  `connect`, because the Broker Endpoint requires mTLS.
- `SecurityHeader`, an interceptor that adds the required
  `broker.spiffe.io: true` metadata. Like the Workload API interceptor,
  it runs an optional custom interceptor first, so that interceptor
  cannot remove or overwrite the header.
- `From` conversions that pack PID and Kubernetes object references
  into a `WorkloadReference` with the full type URL. The conversions
  cannot enforce the reference scope from Broker API §3.1.2, so their
  docs and the module docs state the rules that the caller must
  enforce.
- a `Debug` for the SVID messages that shows only the length of the
  private key or token, like `PrivateKey` and the JWT `Token`.

`cargo run -p xtask -- gen spiffe` also generates these bindings,
without tonic transport code. The Workload API and spire-api output
does not change. The README, CHANGELOG, crate summary and description,
and the Makefile feature and MSRV lanes cover the new feature.

The README, the module docs, and the CHANGELOG state the same
compatibility policy. While `spiffe` is pre-1.0, a breaking change to
`broker-api` requires a minor version bump, and patch releases stay
compatible.

Signed-off-by: Quang Nguyen <[email protected]>
maxlambrecht pushed a commit to maxlambrecht/rust-spiffe that referenced this pull request Oct 2, 2026
Add an experimental `broker-api` feature with bindings for the SPIFFE
Broker API (spiffe/spiffe#340):

- the generated `spiffe.broker` client and messages, under
  `broker_api::pb::spiffe::broker`. The client has no plaintext
  `connect`, because the Broker Endpoint requires mTLS.
- `SecurityHeader`, an interceptor that adds the required
  `broker.spiffe.io: true` metadata. Like the Workload API interceptor,
  it runs an optional custom interceptor first, so that interceptor
  cannot remove or overwrite the header.
- `From` conversions that pack PID and Kubernetes object references
  into a `WorkloadReference` with the full type URL. The conversions
  cannot enforce the reference scope from Broker API §3.1.2, so their
  docs and the module docs state the rules that the caller must
  enforce.
- a `Debug` for the SVID messages that shows only the length of the
  private key or token, like `PrivateKey` and the JWT `Token`.

`cargo run -p xtask -- gen spiffe` also generates these bindings,
without tonic transport code. The Workload API and spire-api output
does not change. The README, CHANGELOG, crate summary and description,
and the Makefile feature and MSRV lanes cover the new feature.

The README, the module docs, and the CHANGELOG state the same
compatibility policy. While `spiffe` is pre-1.0, a breaking change to
`broker-api` requires a minor version bump, and patch releases stay
compatible.

Signed-off-by: Quang Nguyen <[email protected]>
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.

Support for sidecar-less service meshes