Data sanitization to prevent code injection
Data santization is used to prevent code injection problems, by secure input and output handling, such as:
- Input validation
- Selective input inclusion/exclusion
- Escaping dangerous characters. For instance, in PHP, using the
htmlspecialchars()
function (converts HTML tags to theirISO-8859-1
equivalents) and/or strip_tags() function (completely removes HTML tags) for safe output of text in HTML, andmysql_real_escape_string()
to isolate data which will be included in an SQL request, to protect against SQL Injection. - Input encoding
- Output encoding
- Other coding practices which are not prone to code injection vulnerabilities, such as "parameterized SQL queries" (also known as "prepared statements" and sometimes "bound variables" or "bound values").
- Modular shell disassociation from kernel