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

ASF GitHub Bot commented on WW-4539:
------------------------------------

GitHub user yasserzamani opened a pull request:

    https://github.com/apache/struts/pull/49

    WW-4539 Support list of tokens to prevent CSRF attack in async requests

    Nowadays, modern web applications use JQuery, and so, they can send 
multiple async requests in parallel to the web server. Struts has a great token 
mechanism which one of it's use cases is preventing from CSRF attack, but it's 
not usable or hard to use when the user application has multiple valid 
submission from one jsp using JQuery.
    
    This pull request contains all changes needed to enable Struts to handle 
this, transparently (i.e. these changes do not break current user application 
which uses previous token mechanism). Also, this is protected from DOS attack 
by supplying a maximum for count of concurrent valid requests.
    
    I hope you enjoy it.
    Thanks!

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

    $ git pull https://github.com/yasserzamani/struts master

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

    https://github.com/apache/struts/pull/49.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 #49
    
----
commit 5335d68de6a0ab3543e56f1650d7aaa7e8a40d3f
Author: Yasser Zamani <yasser.zam...@live.com>
Date:   2015-09-10T20:59:17Z

    WW-4539 Support list of tokens to prevent CSRF attack in async requests

----


> Handling array of tokens in token session interceptor to prevent CSRF attack 
> in an async-request app
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WW-4539
>                 URL: https://issues.apache.org/jira/browse/WW-4539
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: Future
>            Reporter: Yasser Zamani
>            Priority: Trivial
>              Labels: security
>             Fix For: 2.3.x
>
>
> We have an application based on Struts2 which may call multiple async actions 
> via JQuery AJAX post or form post. To prevent this application from CSRF 
> attacks I'm going to write my own interceptor which is very similar to 
> Struts2 token session interceptor. But this one holds an array of valid 
> tokens instead of one token to enable user to have async multiple requests 
> with different valid token for each one. i.e. my own token TAG will generate 
> different tokens in each inclusion even in one JSP and thread. So, different 
> part of JSP can have their own async requests with valid tokens. Each token 
> will be removed from array when corresponded request has finished.
> I decided to share my work to you for two reasons:
> 1. Maybe you are interested too to have this feature in Struts core.
> 2. To get your feedback if this solution works to prevent CSRF attacks. I 
> just copy from token session interceptor and current token tag in Struts core 
> but still I'm wory about thread safety of my work or any other issue.
> Thanks in advance! 



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

Reply via email to