# Host Tenant Derivation Robustness

> Confirm tenants are derived from server-verified context, so host headers, subdomain aliases or client hints cannot redirect a request into another tenant's view. Use when the product resolves tenant context from hostnames, subdomains or path hints rather than from tokens alone

- Skill: `wsh7ash/host-tenant-derivation-robustness` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/host-tenant-derivation-robustness`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/host-tenant-derivation-robustness/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Wsh7Ash (https://skillmd.com/u/wsh7ash)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/wsh7ash/host-tenant-derivation-robustness

---


# Host and Tenant Derivation Robustness

> Confirm tenants are derived from server-verified context, so host headers, subdomain aliases or client hints cannot redirect a request into another tenant's view

**Use when:** the product resolves tenant context from hostnames, subdomains or path hints rather than from tokens alone

**Avoid when:** tenant context lives solely in a signed token claim that the server verifies and nothing derives from the request

## Procedure

1. Record the derivation order: host, subdomain, port, token claim and header, noting which inputs the server actually trusts.
2. Call identical endpoints with each of your two tenants' hostnames while holding both credentials, and record the pairing outcomes.
3. Test with manipulated hosts inside your own test domain: alternate case, added slash, trailing dot and unknown subdomain names.
4. Check requests where the token's tenant claim differs from the derived host, and verify the server has a defined precedence rule.
5. Inspect caches and background jobs, since they may persist the derived tenant longer than the request needs it.
6. Record the derivation rule per endpoint and any call that conflicts with it for the pairing you measured.

## Signals

- A request initiated deliberately under one hostname resolves to the other tenant when the host header is adjusted inside your own domain.
- Tokens carry tenant claims the host header overrides regardless or, vice versa, the server merely ignores the host context it classified.
- A trailing-dot or case variation on the hostname resolves into the same or a different tenant computation depending on arrival order.
- Cached views or CDS records key on a hostname that a caller can also manipulate inside the next request.

## Patterns

**1. Pairings**

```text
credential=tenant-A  host=app.other-tenant-officer.test -> response scope? -> A or B?
```

**2. Ordering**

```text
token claim=tenant-A host=tenant-B => precedence documented=no conflict-unresolved
```

**3. Result row**

```text
derivation=host-first claim-check=skipped cross-tenant-call-performed=yes-leak-found
```

## Pitfalls

- Assuming host-derived tenant context is safe because the caller cannot own the hostname, while internal routers and caches still do.
- Ignoring inserts with a token-report mismatch because both signals conflicted, yet the server honored whichever came with precedence.
- Publishing an ambiguous result without the exact host, credential and ordering that produced the tenant selection.

## Done when

- The derivation order is recorded with proven precedence rules and no call has an undocumented pairing.
- Cross-tenant host manipulations are tested and every response derived state is attributed to its chosen context.

## References

- [OWASP API Security Top 10](https://owasp.org/www-project-api-security/)
- [OWASP Web Security Testing Guide](https://owasp.org/www-project-web-security-testing-guide/)

