Skip to content

Refuse dot segments in package paths and upstream auth matching - #554

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
simonchrz:fix/dot-segments
Oct 23, 2026
Merged

andrew merged 2 commits into
git-pkgs:mainfrom
simonchrz:fix/dot-segments

Conversation

@simonchrz

@simonchrz simonchrz commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Encoded dot segments such as %2e%2e get past the router's path cleaning. Maven, conda, cran, go and gem append the decoded path to the upstream URL, so the upstream resolves it outside the configured base path. Upstream credentials also matched such URLs by path prefix.

  • Package routes answer 400 for a . or .. segment, also when encoded twice or written with a backslash. This is a middleware next to rejectQueryInPath.
  • URLs with dot segments get no upstream credentials. ;params are ignored for this check, since Tomcat and Jetty drop them before resolving ..;.
  • Package routes also refuse ;, like ? and #. Composer archives stay exempt.

Tests cover every affected ecosystem through mountProtocolHandlers, dotted names that must keep working, and the auth matching.

Routers clean literal dot segments, but encoded ones such as %2e%2e
reach the handlers. Maven, conda, cran, go and gem append the decoded
path to the upstream URL, so the upstream resolved it outside the
configured base path. Package routes now answer 400 for a '.' or '..'
segment, also when encoded twice or written with a backslash.

Upstream credentials matched such a URL by its path prefix, so
/scope/../other still got the credentials configured for /scope. URLs
with dot segments now get no credentials.
Tomcat and Jetty drop ";params" from a path segment before resolving it,
so "..;" passed the dot-segment check and still got the credentials
configured for the upstream path. The check now ignores ";params", and
package routes refuse ';' like '?' and '#', which also stops "1.0;x"
from passing the denylist as a different version. Composer archives
stay exempt, since git branch names may contain ';'.
@andrew
andrew merged commit ec497be into git-pkgs:main Oct 23, 2026
6 checks passed
@simonchrz simonchrz added the breaking Changes behaviour users rely on; needs a minor release label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Changes behaviour users rely on; needs a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants