Re: help create community newbie guide to security

From: Date: Tue, 11 Nov 2003 04:36:52 +0000
Subject: Re: help create community newbie guide to security
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169138@lists.php.net to get a copy of this message
Nice work chris, you have left precious little for the others to comment on :-)
10. Use htmlentities() on data that will be put through a SQL query to prevent XSS attacks. http://php.net/htmlentities
This is a nice suggestion. While htmlentities() cannot be guaranteed to defend against all XSS vulnerabilities, I would bet that most XSS vulnerabilities are due to a complete lack of filtering logic. If a developer doesn't even bother using htmlentities(), neglect is the best word to describe his/her approach to developing. In some cases, the developer may want certain HTML elements interpreted rather than escaped in this way. Perhaps you could mention that something like str_replace() can be used to convert specific HTML entities back to their original form. This method should filter any unwanted elements. but i would still like to add 2c by saying there is also the option of strip_tags which does a more drastic sanitization by removing anything that smells of html.
-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.

« previous php.general (#169138) next »