# Header Privilege Resistance

> Confirm the API derives privilege from tokens it verifies, not from client-supplied headers that announce who they claim to be. Use when requests travel through proxies or internal layers that may forward X-Forwarded-For, X-User, X-Roles or X-Tenant headers

- Skill: `wsh7ash/header-privilege-resistance` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/header-privilege-resistance`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/header-privilege-resistance/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: Wsh7Ash (https://skillmd.com/u/wsh7ash)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/wsh7ash/header-privilege-resistance

---


# Header Privilege Resistance

> Confirm the API derives privilege from tokens it verifies, not from client-supplied headers that announce who they claim to be

**Use when:** requests travel through proxies or internal layers that may forward X-Forwarded-For, X-User, X-Roles or X-Tenant headers

**Avoid when:** no privilege decision involves a client-malleable header, and platform review documents the exact header set

## Procedure

1. Enumerate every inbound header that influences identities, tenants, privileges or routing decisions.
2. Send identical requests with and without each such header to map how behavior changes for your own account.
3. Repeat with each of your two test accounts to find headers that substitute for the other account's identity.
4. Check the shared-product cases: tracing, debug, admin-impersonation and internal-service headers that may be widely honored.
5. Confirm gateway overwrites rather than appends values, so a forged header cannot be smuggled past a controlled proxy.
6. Record which headers the production edge strips, keeps and forwards, since only that set influences real tests.

## Signals

- Supplying a forwarded-user header adopts another identity even though the session cookie still identifies you.
- Deprecation or debug headers unlock alternative outputs that behave like an elevated-call shortcut.
- The gateway appends to rather than overwrites forwarding values, letting client-supplied entries persist behind your proxy.
- A tenant header steers per-tenant routing so calls land in a context the credential never settled in.

## Patterns

**1. Identity header**

```text
as alice + X-User: bob1 -> response material for bob1 -> identity taken from request
```

**2. Gateway merge**

```text
arrivals: X-Forwarded-For kept-appended -> gateway must overwrite, not append
```

**3. Result row**

```text
header=X-User trusted=directly privileged-reachable=yes finding=yes
```

## Pitfalls

- Testing only the pretty header names documented publicly, missing internal variants that steer routing too.
- Ignoring forwarded-protocol style headers that shift not just IP but secure-cookies and TLS-driven decisions.
- Assuming the gateway sanitizes headers because it sits in front, when internal services may consume both.

## Done when

- Every identity-influencing header has been probed with your own two accounts and the substitution outcome recorded.
- Production header handling is documented, and no privilege decision remains that a client-controlled header can steer.

## References

- [OWASP - request forgery and header trust](https://cheatsheetseries.owasp.org/)
- [MDN - HTTP headers security checklist](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers)

