Skip to content

feat(opa): expose caller principal from X-Forwarded-Client-Cert#275

Merged
worstell merged 1 commit intomainfrom
worstell/opa-mtls-principal
Apr 27, 2026
Merged

feat(opa): expose caller principal from X-Forwarded-Client-Cert#275
worstell merged 1 commit intomainfrom
worstell/opa-mtls-principal

Conversation

@worstell
Copy link
Copy Markdown
Contributor

@worstell worstell commented Apr 27, 2026

Parse the URI subject alternative name out of the first XFCC entry and add it to the OPA evaluation input as principal. This lets policies authorize requests by SPIFFE identity (e.g., the caller's Kubernetes ServiceAccount under Istio mTLS) instead of relying on spoofable headers or remote address only.

Empty string when the header is absent or the URI field is missing, so existing policies that don't reference input.principal continue to work unchanged.

Parse the URI subject alternative name out of the first XFCC entry and
add it to the OPA evaluation input as `principal`. This lets policies
authorize requests by SPIFFE identity (e.g., the caller's Kubernetes
ServiceAccount under Istio mTLS) instead of relying on spoofable headers
or remote address only.

Empty string when the header is absent or the URI field is missing, so
existing policies that don't reference `input.principal` continue to
work unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-019dcff2-09b6-71d9-873d-233efceccb70
Co-authored-by: Amp <amp@ampcode.com>
@worstell worstell force-pushed the worstell/opa-mtls-principal branch from d087050 to e4d6679 Compare April 27, 2026 18:46
@worstell worstell marked this pull request as ready for review April 27, 2026 18:49
@worstell worstell requested a review from a team as a code owner April 27, 2026 18:49
@worstell worstell requested review from alecthomas and removed request for a team April 27, 2026 18:49
@worstell worstell merged commit d0185c2 into main Apr 27, 2026
9 checks passed
@worstell worstell deleted the worstell/opa-mtls-principal branch April 27, 2026 18:57
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.

2 participants