What are the best practices for avoiding xss attacks in a PHP site

前端 未结 20 2588
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 02:34

I have PHP configured so that magic quotes are on and register globals are off.

I do my best to always call htmlentities() for anything I am outputing that is derive

20条回答
  •  日久生厌
    2020-11-22 03:01

    Make you any session cookies (or all cookies) you use HttpOnly. Most browsers will hide the cookie value from JavaScript in that case. User could still manually copy cookies, but this helps prevent direct script access. StackOverflow had this problem durning beta.

    This isn't a solution, just another brick in the wall

提交回复
热议问题