Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72055 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7457 invoked from network); 3 Feb 2014 08:18:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 08:18:18 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.99 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.99 smtp99.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.99] ([108.166.43.99:48558] helo=smtp99.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/65-15628-9C05FE25 for ; Mon, 03 Feb 2014 03:18:18 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp5.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id B03031B028E; Mon, 3 Feb 2014 03:18:14 -0500 (EST) X-Virus-Scanned: OK Received: by smtp5.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 5C1121B0282; Mon, 3 Feb 2014 03:18:14 -0500 (EST) Message-ID: <52EF50B6.1030404@sugarcrm.com> Date: Mon, 03 Feb 2014 00:17:58 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Yasuo Ohgaki CC: "internals@lists.php.net" References: <52EDBB30.3070209@ajf.me> <52EE1C2B.7030702@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Improve HTML escape From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Users can do > > They also can do and . That's not what they _should_ be doing, but they _can_ do it. That doesn't mean there's something wrong with echo or PHP compiler. > and this is valid. I think there is no reason not to escape ' by default. > > I agree that user should not use unquoted attributes in general. > > '/' escape could be still useful. For example, user may have validation I don't see how it would be useful. > code that allows printable ASCII chars w/o spaces. '/' escape may protect > apps from generating invalid tag in this case. This seems to be a very contrives scenario invented to fit your point. If they already pre-filter input, they could also remove / or other special characters. The fact is that htmlentities is useless as security feature in this context, and removing / does not make it useful. Saying "we'll add escape so that it would be safe" is magic-quotes kind of mistake - it gives the users wrong impression that it's OK to do things that they should not be doing. > There is no reason not to escape these chars by default. IMHO. There is a reason - there's no reason to escape them. In every scenario that htmlentites should be used, escaping them is useless. In every scenario where espacing / is useful, htmlentities should not be used. By promoting usage of htmlentities in scenarios where it should absolutely not be used, we are only doing the users a disservice. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227