Skip to content

console: classify the decoded path the router dispatches on - #91

Merged
clibequilibrium merged 1 commit into
mainfrom
preview
Nov 17, 2026
Merged

clibequilibrium merged 1 commit into
mainfrom
preview

Conversation

@clibequilibrium

Copy link
Copy Markdown
Member

No description provided.

The console guard split the raw, still-percent-encoded url.pathname to
decide whether a request was public or operator-only. SvelteKit's router,
though, decodes each segment before matching a route. The two disagreed:
/%61pi/registry/projects has first segment %61pi, which matches none of
the guard's protected prefixes, so classifyAccess returned open and the
request sailed through with no session - yet the router decoded it to api
and ran the real /api/registry/projects handler.

Signed out, that exposed every operator endpoint under /api/* to anyone:
listing and creating registry projects, /api/console/me, and the
project-scoped proxies behind them. Confirmed against a live dev stack -
GET /%61pi/registry/projects returned 200 before, 401 after.

Fix it at the one place that matters: decode each segment the way the router
does and classify that. The same transform feeds the service-key surface
check, so authentication and authorization see one path. Per segment and
never re-split, so an encoded slash in a catch-all can't fan out into
segments the classifier would read as structure; a malformed escape names no
route and is left as-is. Adds an e2e test that attacks the encoded prefix.
@clibequilibrium
clibequilibrium merged commit 6060592 into main Nov 17, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant