====== PHP RFC: Improve HTML escape ======
* Version: 1.0
* Created: 2014-02-03
* Date: 2014-02-10
* Author: Yasuo Ohgaki
* Status: Declined
* First Published at: http://wiki.php.net/rfc/secure-html-escape
===== Introduction =====
HTML escape can be improved by escaping all dangerous chars. HTML escape can be improved by escaping "<", ">", """, "'", "&" and "/".
OWASP [[https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
|recommends]] escaping "<", ">", """, "'", "&" and "/".
[[https://wiki.php.net/rfc/default_encoding|PHP 5.6 has default character encoding]], If PHP ignores ENT_COMPAT, users may write simply
Weak legacy scripts may be protected also by this change.
User may do
>
When this is the case, HTML TAG structure is broken. It's broken in first place as attribute is not quoted, but it would not be good to destroy tag structure while we can avoid it.
Or broken HTML parser may recognize JavaScript comment and execute malicious code.
Escaping all chars recommended by OWASP always is more secure and preferred.
NOTE: PCI DSS standard requires to follow OWASP, SANS, NIST and other security standards and guidelines.
===== Proposal =====
Escape all chars OWASP recommends.
* Deprecate ENT_COMPAT/ENT_QUOTES and ignore them and add "/" escape.
===== Backward Incompatible Changes =====
None for almost all applications.
Since output differs, there might be test program issues.
===== Proposed PHP Version(s) =====
PHP 5.6 and up
===== Open Issues =====
===== Vote =====
VOTE: 2014/02/17 - 2014/02/24
* Yes
* No
Thank you for voting!
===== Patches and Tests =====
TBD
===== Implementation =====
After the project is implemented, this section should contain
- the version(s) it was merged to
- a link to the git commit(s)
- a link to the PHP manual entry for the feature
===== References =====
Links to external references, discussions or RFCs
* http://marc.info/?l=php-internals&m=139131067522473&w=2
===== Rejected Features =====
Keep this updated with features that were discussed on the mail lists.