angularjs - Token Authentication and XSRF / XSS protection -


I'm reading the possibility of XSRF and XSS attacks to get token authentication and authentication information.

I understand that to stop XSRF attacks, it is a popular way to read a custom authentication token from a cookie and then add it to a custom request header before making any AJAX request. The server can run verification on the request header instead of the cookie. I believe AngularJS uses this approach: $ http

My confusion comes when XSS stops attacks, it is best to ensure that any user input is injected to Javascript Not able to do, but to get a blame, there is a need to read to set its value in the cookie request header mentioned above, it is not weak for XSS attacks? Since the cookie can not be set to HTTP only, can an attacking author not read the cookie to get the token and then make a request? If so, how can it be stopped?

Any information is appreciated.

The cookie will only be weak for XSS attacks if your site is weak for XSS attacks.

So you have to make sure that any user input is cleared before appearing on the page.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -