This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new bb4624a9f3 Avoid protocol relative redirects bb4624a9f3 is described below commit bb4624a9f3e69d495182ebfa68d7983076407a27 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Aug 22 11:31:23 2023 -0700 Avoid protocol relative redirects --- java/org/apache/catalina/authenticator/FormAuthenticator.java | 6 ++++++ webapps/docs/changelog.xml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/java/org/apache/catalina/authenticator/FormAuthenticator.java b/java/org/apache/catalina/authenticator/FormAuthenticator.java index 2876a2d04c..c66ae56454 100644 --- a/java/org/apache/catalina/authenticator/FormAuthenticator.java +++ b/java/org/apache/catalina/authenticator/FormAuthenticator.java @@ -747,6 +747,12 @@ public class FormAuthenticator extends AuthenticatorBase { sb.append('?'); sb.append(saved.getQueryString()); } + + // Avoid protocol relative redirects + while (sb.length() > 1 && sb.charAt(1) == '/') { + sb.deleteCharAt(0); + } + return sb.toString(); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0b37d87df5..b52bde0b9f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -117,6 +117,9 @@ Update code comments and Tomcat output to use MiB for 1024 * 1024 bytes and KiB for 1024 bytes rather than MB and kB. (martk) </fix> + <fix> + Avoid protocol relative redirects in FORM authentication. (markt) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org