Repository navigation
console: classify the decoded path the router dispatches on - #91
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.