kin-openapi's encoded-path bypass shows why a route match is not an authorization decision
kin-openapi through 0.153.0 contains an authentication bypass tracked as CVE-2026-142245. Percent-encoded request paths can cause validation to match a public operation while the router serves a protected handler. The request can then reach application code without calling the configured authentication function.
The parser disagreement
The GitHub advisory describes three related surfaces: Servers.MatchURL, middleware validation, and routing. Encoded separators or other encoded characters are interpreted differently across those stages. Validation selects a public operation from one representation of the path, while the router chooses a protected handler from another.
That is a canonicalization problem. Authorization is only as strong as the path representation used by the component that makes the decision. A public documentation route and a protected API route can share a prefix, redirect history, or normalized form and still require the same server-side treatment.
The GHSA rates this 9.1 under CVSS v4.0 with CWE-647. The reviewed advisory did not list a patched version at publication time. The issue is an incomplete fix for CVE-2026-100351, so checking only the earlier change is not enough.
Defensive response
Track the first fixed kin-openapi release and update the library and any generated validation code. Before the patch is available, place authorization checks in the protected handlers or a gateway that receives the same normalized path as the router. Do not rely only on OpenAPI security requirements or a public route table.
Reject ambiguous encoded separators before routing. Normalize once, then use that canonical value for route selection, validation, authorization, and logging. Add regression tests for uppercase and lowercase percent encoding, encoded slashes, dot segments, repeated separators, and mixed encoding.
Review access logs for requests whose encoded path does not match the operation that ultimately ran. Alert when a public route receives a protected handler response or when an authentication function is skipped for a sensitive endpoint.
Design the boundary
An API specification is documentation and a validation input. It is not the final authority on who may perform an action. Keep policy enforcement in a layer that knows the authenticated principal, the selected handler, and the canonical path. When those three values disagree, deny the request.
