You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/07/09 12:24:05 UTC

[jira] [Commented] (CXF-6492) AbstractHTTPDestination class incorrectly assume only one empty space after "Basic" in Authorization header value.

    [ https://issues.apache.org/jira/browse/CXF-6492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14620274#comment-14620274 ] 

ASF GitHub Bot commented on CXF-6492:
-------------------------------------

GitHub user sagara-gunathunga opened a pull request:

    https://github.com/apache/cxf/pull/81

    Fixed CXF-6492 - Don't assume only one empty space after 'Basic' in A…

    …uthorization header

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sagara-gunathunga/cxf master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/81.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #81
    
----
commit 9013cf43a53e7a541b459a20c84ede47fdac46c0
Author: Sagara <sa...@gmail.com>
Date:   2015-07-09T10:31:37Z

    Fixed CXF-6492 - Don't assume only one empty space after 'Basic' in Authorization header

----


> AbstractHTTPDestination class incorrectly assume only one empty space after "Basic" in Authorization header value. 
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-6492
>                 URL: https://issues.apache.org/jira/browse/CXF-6492
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.16, 3.1.1
>            Reporter: Sagara Gunathunga 
>
> getAuthorizationPolicyFromMessage() method in AbstractHTTPDestination class  incorrectly assume only one empty space after "Basic" in Authorization header value but one can send multiple empty spaces after "Basic" string or can skip the content after "Basic" string in both cases CXF returns Java exceptions along with stack trace to the client side. 
> case -1  : curl http://localhost:8080/hello/echo/hello -H "Authorization:Basic  YWRtaW46YWRtaW4="   ( 2 whitespace characters after "Basic" )
> java.lang.NullPointerException
> 	at java.lang.String.&lt;init&gt;(String.java:556)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.getAuthorizationPolicyFromMessage(AbstractHTTPDestination.java:167)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.setupMessage(AbstractHTTPDestination.java:385)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:236)
> 	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
> 	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:217)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
> case - 2 : curl http://localhost:8080/hello/echo/hello -H "Authorization:Basic" ( No content after "Basic") 
>  
> Server Error</pre></p><h3>Caused by:</h3><pre>java.lang.ArrayIndexOutOfBoundsException: 1
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.getAuthorizationPolicyFromMessage(AbstractHTTPDestination.java:165)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.setupMessage(AbstractHTTPDestination.java:385)
> 	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:236)
> 	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
> 	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
> 	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)
> 	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:217)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)