Treat all client supplied headers as untrusted unless a reverse proxy explicitly strips them before the application sees the request. Certificate-based authentication should rely only on proxy generated environment variables, not user controllable X-prefixed headers. Teams should also verify that proxy configuration removes spoofable trust signals and that downstream code never accepts header values as equivalent to TLS validated identity data.
Why This Matters for Security Teams
Trusted-proxy header spoofing is dangerous because certificate-based authentication often creates a false sense of certainty: once a proxy has validated a client certificate, downstream services may start trusting identity claims carried in headers. Attackers exploit that trust boundary by sending user-controlled X-prefixed values that mimic proxy-injected identity data. This is especially risky in architectures that mix mutual TLS, reverse proxies, and legacy application code that still treats headers as authoritative.
Security teams should assume that any header can be supplied by the client unless the proxy strips it first and reissues identity context in a non-spoofable way. That principle aligns with broader guidance in the CISA cyber threat advisories and the NHI governance lessons reflected in Ultimate Guide to NHIs — What are Non-Human Identities. In practice, many teams discover the problem only after a perimeter trust assumption has already been bypassed in production.
How It Works in Practice
The correct defense starts at the proxy boundary. The proxy should terminate TLS, validate the client certificate, and then remove any inbound identity headers before forwarding the request. Downstream applications should consume only proxy-generated environment variables or equivalent server-side context, never values that can be set by the requester. That is the key distinction: TLS proves the client identity at the transport layer, while headers are just application data unless they are explicitly made trustworthy by the proxy.
Security teams should also make the trust chain explicit in configuration and code reviews. A strong implementation usually includes:
- Stripping all client-supplied identity headers at the edge proxy.
- Rewriting identity context only after successful certificate validation.
- Using allowlists for headers that may be forwarded to applications.
- Rejecting direct-to-origin access so the application never sees bypass traffic.
- Logging certificate subject details separately from request headers for auditability.
Where teams need a control baseline, NIST SP 800-53 Rev 5 Security and Privacy Controls provides a useful structure for access enforcement, monitoring, and boundary protection. The broader NHI risk is illustrated by incidents such as the Sisense breach and DeepSeek breach, where trust in exposed or mismanaged identity material created outsized impact. These controls tend to break down when applications are deployed behind multiple proxies or ingress layers because one layer preserves headers that another layer assumed had already been sanitized.
Common Variations and Edge Cases
Tighter header sanitisation often increases deployment friction, requiring organisations to balance stronger identity assurance against compatibility with older apps, sidecars, and nested proxy chains. That tradeoff is real, especially where teams cannot refactor every service at once.
Current guidance suggests treating mTLS and header-based identity as separate trust mechanisms, even when they are operationally linked. In a zero-trust design, certificate validation should establish the caller’s authenticated transport identity, while application identity should be derived from a controlled server-side signal. Do not let one layer silently inherit the assumptions of another.
Edge cases include service meshes, API gateways, and hybrid environments where multiple intermediaries may add, transform, or preserve headers. The safest pattern is to define a single authoritative hop that stamps identity after validation and to block any request that already contains those headers on entry. Where teams handle secrets or token exchange in the same flow, the fragmentation risks described in The State of Secrets in AppSec reinforce why audit trails must distinguish validated transport identity from user-controlled metadata. There is no universal standard for this yet across all proxy stacks, so policy, configuration, and application code all need to agree on the same trust boundary.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-01 | Validates that identity data must not be trusted from user-controlled request paths. |
| OWASP Agentic AI Top 10 | Runtime trust decisions and untrusted inputs mirror agentic request-context abuse patterns. | |
| CSA MAESTRO | Addresses trust boundaries and policy enforcement across distributed AI and service components. | |
| NIST AI RMF | Supports governing identity trust decisions and risk controls for dynamic system interactions. | |
| NIST Zero Trust (SP 800-207) | SC-7 | Boundary enforcement is central to preventing direct bypass of the trusted proxy. |
Evaluate identity assertions at request time and reject context that was not cryptographically bound.
Related resources from NHI Mgmt Group
- How do security teams know whether certificate-based authentication is over-trusted?
- How should security teams govern certificate-based authentication for machines and devices?
- How should security teams choose between FIDO and certificate-based authentication?
- How should security teams decide between certificate-based authentication and MFA?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org