javascript - CSRF using Angular.js with PHP CodeIgniter backend -


i trying implement csrf angular.js , codeigniter, however, not sure if method secure.

when angular sends post, put, or delete request, have custom security class in php check $_server['http_cookie'] request. if includes csrf cookie, verify against value in $_cookie variable.

i not sure if these same values , not doing or what. there better way should handling this?

i have not worked angular js codeigniter. csrf protection codeigniter provides security class providing security token(or csrf cookie) respective requests either via form. need enable feature under config file:

location: application/config/config.php default code: $config['csrf_protection'] = false; change to: $config['csrf_protection'] = true; 

by making true, automatically inserts security token in form, verified @ server end. can change token name & cookie name in same file via below config settings:

$config['csrf_token_name'] $config['csrf_cookie_name'] 

one important thing that, if refresh page, security token doesn't change, or think same security token current user session. drawback have found codeigniter. if want same implementation ajax, either need add manual code passing token name or value or use ajaxsetup requests.

by way can achieve csrf protection @ level, if want more security can check httponly cookies or ssl deployemnt subject project need.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -