Manual HTML sanitization detected.
- Rule ID: php_lang_manual_html_sanitization
- Languages: php
- Source: manual_html_sanitization.yml
Description
Sanitizing HTML manually is error prone and can lead to Cross Site Scripting (XSS) vulnerabilities.
Remediations
❌ Avoid manually escaping HTML:
$html = str_replace("&", "&", $text);
✅ Use a HTML sanitizer:
$html = htmlspecialchars($text);
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=php_lang_manual_html_sanitization
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=php_lang_manual_html_sanitization
Ready to take the next step? Learn more about Bearer Cloud.