├── README.md └── resource └── event_handler.txt /README.md: -------------------------------------------------------------------------------- 1 | # can-i-protect-xss 2 | Everything about xss protection technology 3 | 4 | ## :100: Best practice 5 | Get and handle only the values that developers can predict. 6 | 7 | e.g 8 | ``` 9 | /list?id=1 10 | /list?id=2 11 | /list?id=3 12 | .... 13 | 14 | In this case, only numeric values are required for the id parameter. 15 | For these parameters, that you better not to not processing other than type(string, etc..) for avoid multiple vulnerability. 16 | It's better not to aim for unnecessary reflection and DOM write. 17 | ``` 18 | 19 | ## :shield: Protection Technic 20 | ### 1. Escape the Special char 21 | `&` => `&`
22 | `"` => `"`
23 | `'` => `'`
24 | `<` => `<`
25 | `>` => `>`
26 | `/` => `/`
27 | 28 | encoding pattern 29 | - HTML: `<` 30 | - URL: `%3c` 31 | - Unicode: `\u003c` 32 | - CSS: `\3c` `\0003c` 33 | 34 | ### 2. If you needs tag? 35 | filtering xss tags and event handler, dangerous attribute 36 | - filtering xss tags(running with out eventhandler) 37 | ``` 38 |