@@ -1182,15 +1182,16 @@ impl AudienceVerifier {
11821182
11831183/// Returns true if the given value is a safe relative redirect target.
11841184///
1185- /// Only paths starting with a single `/` (not `//`) are accepted, and any value
1186- /// containing a backslash is rejected. The WHATWG URL Standard treats `\` as
1187- /// equivalent to `/` for special schemes (http/https), so `/\evil.test` parses
1188- /// to the authority `evil.test`, i.e. `http://evil.test/`. SQLPage itself uses a
1189- /// WHATWG parser (the `url` crate) when it builds the absolute
1190- /// `post_logout_redirect_uri`, so without this check a value classified as
1191- /// "relative" becomes an external open-redirect target on the server side,
1192- /// independent of the client. Browsers implementing the same standard (Chromium,
1193- /// Firefox, Safari) resolve a `Location: /\evil.test` the same way.
1185+ /// Only paths starting with a single `/` (not `//`), with no backslash and no
1186+ /// ASCII control characters, are accepted. The WHATWG URL Standard treats `\` as
1187+ /// equivalent to `/` for special schemes (http/https) and strips tab/newline/CR
1188+ /// before parsing, so `/\evil.test` and `/\t/evil.test` both parse to the
1189+ /// authority `evil.test`, i.e. `http://evil.test/`. The `url` crate that builds
1190+ /// the absolute `post_logout_redirect_uri` is itself a WHATWG parser, so without
1191+ /// this check a value classified as "relative" becomes an external open-redirect
1192+ /// target on the server side, independent of the client. Browsers implementing
1193+ /// the same standard (Chromium, Firefox, Safari) resolve a `Location: /\evil.test`
1194+ /// the same way.
11941195pub ( crate ) fn is_safe_relative_redirect ( uri : & str ) -> bool {
11951196 // Reject backslashes and ASCII control characters. The WHATWG URL parser
11961197 // used by SQLPage's `url` crate (and by browsers) treats `\` as `/`, and it
0 commit comments