# Route Normalization Guard

> Check that slugs, encodings, dot segments and duplicate separators all resolve consistently, so admin routes stay admin routes after every rewrite. Use when the API mixes route matching across gateways, services and frameworks, where each library normalizes URLs slightly differently

- Skill: `wsh7ash/route-normalization-guard` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/route-normalization-guard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/route-normalization-guard/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/route-normalization-guard

---


# Route Normalization Guard

> Check that slugs, encodings, dot segments and duplicate separators all resolve consistently, so admin routes stay admin routes after every rewrite

**Use when:** the API mixes route matching across gateways, services and frameworks, where each library normalizes URLs slightly differently

**Avoid when:** a single framework handles all routing and its documented matcher behavior covers the whole request path

## Procedure

1. Sketch the route chain from edge to handler, noting which layer your privileged checks run in and which normalize paths.
2. Build a variant list: encoded slashes, percent-encoded characters, dot segments, cases, trailing slashes and duplicated paths.
3. Send your protected list through every variant with your own lower-privileged credential and record the result.
4. Watch specifically for variants that add or drop characters from the logged or judged selection, which desyncs layers.
5. Repeat the tour with absolute URIs and non-fixed host headers, which some proxy setups treat differently.
6. Record the matrix of variants by outcome so a normalizer mismatch is visible at a glance.

## Signals

- One variant of the same admin path returns 200 through a less privileged role, proving layers disagree.
- Percent-decoding happens later than authorization, so encoded slugs reach a handler that was judged on another path.
- A prefix rule protects a name exactly, so only literal matches take effect while suffixes with extra traversal slip.
- Trailing-slash handling directs some requests to a separate handler that skips the middleware registration entirely.

## Patterns

**1. Variant set**

```text
/api/admin /api/admin/ /API/Admin \/api%2fadmin \/api/admin%2f \/api//admin \/api/./admin \/api/../admin
```

**2. Layer desync**

```text
gateway authorizes /api/admin, handler matches \/api/[a-z]*/admin  -> variant variants matching rule differ
```

**3. Result row**

```text
path=/api/admin variants=9 admin-authorized-yes=6 allowed-through=3 sample=%2fslash-case
```

## Pitfalls

- Testing variants only against your own endpoints and never against privileged ones where the mismatch actually pays.
- Assuming HTTP-tool behavior equals proxy behavior, then publishing findings the real frontend rejects.
- Reporting the mismatch without characterizing the two layers' normalization, which makes the finding unreproducible.

## Done when

- Each string in the variant set is classified by both ends as the same resource or different resources, and the mismatch is recorded.
- Every mismatch is reproduced cleanly once with the exact path, host and headers required to observe it.

## References

- [RFC 3986 - URI generic syntax](https://www.rfc-editor.org/rfc/rfc3986)
- [OWASP - authentication and routing pitfalls](https://cheatsheetseries.owasp.org/)

