Skip to content

Instantly share code, notes, and snippets.

View cure53's full-sized avatar

Cure53 cure53

View GitHub Profile
@cure53
cure53 / XSS Protection in 5 common contexts
Created December 15, 2016 13:53 — forked from soaj1664/XSS Protection in 5 common contexts
Per-Context Sanitizer Functions
<?php
/**
* XSS protection function for HTML context only
* @usecases
* <title>use this function if output reflects here or as a content of any HTML tag.</title>
* e.g., <span>use this function if output reflects here</span>
* e.g., <div>use this function if output reflects here</div>
* @description
* Sanitize/Filter < and > so that attacker can not leverage them for JavaScript execution.