This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 24b0494883 Keep pre-flight checks aligned with 
CorsFilter.checkRequestType
24b0494883 is described below

commit 24b0494883aa690893a3d2e5a37611f4a1d8061b
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jun 22 16:44:00 2026 +0100

    Keep pre-flight checks aligned with CorsFilter.checkRequestType
    
    Note: "Origin: null" is a legal origin and there are circumstances where an 
admin may wish to allow it.
---
 java/org/apache/catalina/authenticator/AuthenticatorBase.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
index 713740ede4..b5915d1896 100644
--- a/java/org/apache/catalina/authenticator/AuthenticatorBase.java
+++ b/java/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -114,6 +114,7 @@ public abstract class AuthenticatorBase extends ValveBase 
implements Authenticat
      * Returns the realm name for the given context.
      *
      * @param context the context
+     *
      * @return the realm name
      */
     protected static String getRealmName(Context context) {
@@ -660,6 +661,7 @@ public abstract class AuthenticatorBase extends ValveBase 
implements Authenticat
      * Determines whether a CORS preflight request should bypass 
authentication.
      *
      * @param request the request to check
+     *
      * @return {@code true} if the CORS preflight request should bypass 
authentication
      */
     protected boolean allowCorsPreflightBypass(Request request) {
@@ -670,9 +672,8 @@ public abstract class AuthenticatorBase extends ValveBase 
implements Authenticat
             // This is a subset of the tests in CorsFilter.checkRequestType
             if (Method.OPTIONS.equals(request.getMethod())) {
                 String originHeader = 
request.getHeader(CorsFilter.REQUEST_HEADER_ORIGIN);
-                if (originHeader != null && !originHeader.isEmpty()
-                        && !"null".equals(originHeader) && 
RequestUtil.isValidOrigin(originHeader)
-                        && !RequestUtil.isSameOrigin(request, originHeader)) {
+                if (originHeader != null && !originHeader.isEmpty() && 
RequestUtil.isValidOrigin(originHeader) &&
+                        !RequestUtil.isSameOrigin(request, originHeader)) {
                     String accessControlRequestMethodHeader =
                             
request.getHeader(CorsFilter.REQUEST_HEADER_ACCESS_CONTROL_REQUEST_METHOD);
                     if (accessControlRequestMethodHeader != null && 
!accessControlRequestMethodHeader.isEmpty()) {
@@ -1229,6 +1230,7 @@ public abstract class AuthenticatorBase extends ValveBase 
implements Authenticat
      *
      * @param request the request being processed
      * @param session the session whose ID should be changed
+     *
      * @return the new session ID
      */
     protected String changeSessionID(Request request, Session session) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to