Expose TLS peer certificate validation status in CEL context etc.
#45.660 geöffnet am 16.06.2026
Repository-Metriken
- Stars
- (27.997 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)
Beschreibung
In an optional mTLS setting, i.e. where a client may present a certificate, which in turn is accepted even if untrusted (i.e. with verify_trust_chain: ACCEPT_UNTRUSTED), a user is still interested in whether a peer certificate was presented and whether it was valid.
The information whether a certificate was presented is currently already being exposed using the connection.mtls context attribute. The validation status, however, is not. I therefore propose introducing a new context attribute that reflects the validation status in a similar vein, e.g. connection.peer_certificate_valid.
Furthermore, but I'm open to opening a separate issue for this, having a substitution formatter variable like '%DOWNSTREAM_PEER_CERTIFICATE_VALIDATION_STATUS%' that reflects this information would be good to have as well. There could be some predefined values for successful validation, failed validation, and no certificate having been presented. nginx exposes something similar in its ssl_client_verify variable.
Relevant Links: This information is already exposed to the Lua filter, as was introduced in #12174. Making it available in more locations makes it easier to do certain things (such as add a header with this information) without having to resort to the "big guns" of a Lua filter.