Skip to content

Conversation

@Ayushd785
Copy link
Contributor

Description

Motivation:
This change adds support for forwarding client certificate details to upstream backends via headers, addressing a feature gap for users migrating from ingress-nginx. In ingress-nginx, this functionality is available via the nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream: "true" annotation, and users need equivalent functionality in kgateway.

What changed:

  • Added ClientCertificateForwarding field to HTTPSettings in ListenerPolicy API
  • Implemented conversion from API to IR in the listener policy plugin
  • Applied SetCurrentClientCertDetails configuration to Envoy's HttpConnectionManager proto
  • The feature supports forwarding:
    • Subject: Certificate subject
    • Cert: Full certificate in URL encoded PEM format (appears in XFCC header)
    • Chain: Certificate chain in URL encoded PEM format (appears in XFCC header)
    • Dns: DNS type Subject Alternative Names
    • Uri: URI type Subject Alternative Name

Related issues:
Fixes #13047

Change Type

/kind feature

Changelog

Added support for forwarding client certificate details to upstream backends via the `clientCertificateForwarding` field in `ListenerPolicy`'s `httpSettings`.

@Ayushd785 Ayushd785 requested a review from a team as a code owner January 1, 2026 23:11
@gateway-bot gateway-bot added kind/feature Categorizes issue or PR as related to a new feature. release-note labels Jan 1, 2026
@Ayushd785 Ayushd785 force-pushed the add-client-certificate-forwarding branch from 26463a9 to 9131956 Compare January 1, 2026 23:15
Copy link
Contributor

@sheidkamp sheidkamp left a comment

Choose a reason for hiding this comment

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

What's there looks straightforward, though there are some gaps to address?

xffNumTrustedHops = ptr.To(uint32(*h.XffNumTrustedHops)) // nolint:gosec // G115: kubebuilder validation ensures safe for uint32
}

clientCertForwarding := convertClientCertificateForwarding(h.ClientCertificateForwarding)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could inline like convertHeaderMutations


// ClientCertificateForwarding configures which parts of the client certificate
// should be forwarded to upstream backends via headers.
// This is only applicable when mTLS is configured on the listener.
Copy link
Contributor

Choose a reason for hiding this comment

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

The envoy docs say:

This field is valid only when [forward_client_cert_details](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#envoy-v3-api-field-extensions-filters-network-http-connection-manager-v3-httpconnectionmanager-forward-client-cert-details) is APPEND_FORWARD or SANITIZE_SET

The default value of forward_client_cert_details is "SANITIZE" and we do not set it anywhere in the code. It looks like we need to expose that field as well for this to work.

Also, we should validate that when ClientCertificateForwarding is configured, mTLS is enabled on the listener and forward_client_cert_details is properly set.

Copy link
Contributor

Choose a reason for hiding this comment

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

agree re forward_client_cert_details - to simplify, do you think that if this field is not nil we can set it to SANITIZE_SET automatically? I'm trying to think how to reduce config knobs for users (while still allowing to support the future feature set in the future if needed)..

Re verify that mTLS is enabled - I agree that would be the ideal, but i'm not sure there's an easy way from this part in the code to know if the listener is doing mTLS or not...

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to rename the field to express the desired state using a verb forward_client_cert_details

@Ayushd785
Copy link
Contributor Author

Hi @sheidkamp, thank you for taking the time to review my PR. I’ll go through your feedback carefully and update the changes accordingly.

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

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client certificate forwarding

5 participants