OWASP CSRF token with JSF ajax request -
we secured our website using owasp csrf guard , configured tokenperpage=true. use jsf 2.0 (myfaces) our front-end development.
every thing works expected except when use jsf ajax (). when submit ajax request page, ajax request successful subsequent http request fails message
("potential cross-site request forgery (csrf) attack thwarted (user:%, ip:x.x.x.x, uri:/ppr/secured/xxxx.faces, error:request token not match page token)").
below speculation :
- in jsf url displayed in browser address bar previous page/request url ( jsf 'post' submits request same view , uses forward dispatcher). , ajax request page uses current page's url. may ajax request overrides token.
for troubleshooting - captured request/response using fiddler , exported file. can open using fiddler.
this image in describing requests in fiddler file.
fiddler_owasp_csrf_jsf_ajax_issue.jpg
jsf code -fyr :
<t:datatable id="xyztableid" value="#{varobject.additionalnotes}" var="additionalnote"><t:column> <h:inputtext id="additionalnotemsg" value="# {additionalnote.message}"> <f:ajax event="blur" render="noteform:xyztableid:#{rowindex}:displayid" onerror="printajaxerror" /> </h:inputtext></t:column> </t:datatable> <t:commandbutton type="button" value="add notes" id="button1"/>
Comments
Post a Comment