You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4036867
Browse filesBrowse the repository at this point in the historyBrowse files
fix(@angular/ssr): prevent open redirect via protocol-relative pathname
The `Location` header for a server-side navigation was built by joining the
`PlatformLocation` pathname with the search and hash. A pathname may start with
`//`, which as a `Location` value is a protocol-relative URL to another origin.
The router serializes `/.;/(//example.com)` to `/.//example.com`, dot-segment
removal leaves `//example.com`, and a single unauthenticated `GET` returned
`302 Location: //example.com`. Any route with a parameter in the first segment
and a wildcard child is affected, with no redirect logic in the application.
Collapse the leading slashes of the pathname before using it as a location, and
normalize the same way in `createRedirectResponse()`, which also prefixes a
slash so the value cannot resolve anywhere but the current origin.
The collapse consumes tab, line feed and carriage return too: the WHATWG URL
parser removes them before parsing, so a client reads `/\t/example.com` as
`//example.com`. Tab is a legal header value character and reaches the wire, and
prefixing a slash would otherwise turn a leading tab, which the header layer
trims, into an inner one that it does not.
0 commit comments