You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2018/07/31 07:53:48 UTC

[Bug 62585] New: CorsFilter `supportsCredentials` and `anyOriginAllowed` cannot co-exist

https://bz.apache.org/bugzilla/show_bug.cgi?id=62585

            Bug ID: 62585
           Summary: CorsFilter `supportsCredentials` and
                    `anyOriginAllowed` cannot co-exist
           Product: Tomcat 8
           Version: 8.5.32
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: fuweichin@gmail.com
  Target Milestone: ----

*Steps to reproduce*
I have CorsFitler used in some of my webapps:

> <filter>
> 	<filter-name>cors</filter-name>
> 	<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
> 	<init-param>
> 		<param-name>cors.allowed.origins</param-name>
> 		<param-value>*</param-value>
> 	</init-param>
> 	<!-- ... -->
> 	<init-param>
> 		<param-name>cors.support.credentials</param-name>
> 		<param-value>false</param-value>
> 	</init-param>
> </filter>


*Actual Result*
After upgrading Tomcat from 8.5.23 to 8.5.32, some of my webapps were failed to
start. the root cause in error log says:

> It is not allowed to configure supportsCredentials=[true] when allowedOrigins=[*]

By viewing source, I found that the error was caused by a change in CorsFilter,
more specifically, the following lines:

> if (this.supportsCredentials && this.anyOriginAllowed) {
>    throw new ServletException(sm.getString("corsFilter.invalidSupportsCredentials"));
> }


*Expected Result*
I know 'Access-Control-Allow-Origin: *' and 'Access-Control-Allow-Credentials:
true' MUST NOT co-exist, but parameter allowedOrigins is server configuration
concept and doesn't fully correspond to response header
Access-Control-Allow-Origin.

I think the change is not neccessary even in name of security, SSL certificates
may have a wildcard common name, it doesn't make sense that Tomcat suddenly
restrict a specific list of allowedOrigins to support credentials.

Think about such a scenario:
+ You want to share your REST resources with any other origin
+ You want to support credentials

What should I do? to fork CorsFilter and write a new one? or to ask for
reverting the change, as what I'm doing now?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62585] CorsFilter `supportsCredentials` and `anyOriginAllowed` cannot co-exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62585

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
When allowedOrigins is configured to be "*" it does corresponding exactly with
the  Access-Control-Allow-Origin response header.

See https://bz.apache.org/bugzilla/show_bug.cgi?id=62343 for references to the
security issues this change was intended to fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62585] CorsFilter `supportsCredentials` and `anyOriginAllowed` cannot co-exist

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62585

Fuwei Chin <fu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Fuwei Chin <fu...@gmail.com> ---
Sorry the submitted filter XML comes from a revised edition.

The original edition of filter XML is like

> <filter>
> 	<filter-name>cors</filter-name>
> 	<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
> 	<init-param>
> 		<param-name>cors.allowed.origins</param-name>
> 		<param-value>*</param-value>
> 	</init-param>
> 	<!-- ... -->
> 	<init-param>
> 		<param-name>cors.support.credentials</param-name>
> 		<param-value>true</param-value>
> 	</init-param>
> </filter>

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org