spring - How to know if my CSRF is working? -


i trying implement csrf using spring , freemarker template.

due restrictions of freemarker had add javascript function make work, saw here:

http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#csrf-include-csrf-token

so, added code:

$(function () { var token = $("meta[name='_csrf']").attr("content"); var header = $("meta[name='_csrf_header']").attr("content"); $(document).ajaxsend(function(e, xhr, options) {     xhr.setrequestheader(header, token); }); }); 

as far see, not adding anything, metatags no content... , ajaxsend cannot 100% sure working, there way know working?

i read default csrf enabled. , have correct chain filters (as far check).

i using spring 3.2.8 , security 3.2.5 freemarker 2.3.2

is there way verify this?

thanks

if want check csrf filter preventing malicious requests, use tool firefox-plugin "tamper-data" able manipulate request before send. such tool can delete or change sended csrf-prevention token. -- when change or delete it, server must repsond error (not authorized or that) -- if server full fill request normal, crsf protection not working.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -