Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79021 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27140 invoked from network); 20 Nov 2014 07:38:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2014 07:38:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.49 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.49 mail-pa0-f49.google.com Received: from [209.85.220.49] ([209.85.220.49:44161] helo=mail-pa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/12-14967-37A9D645 for ; Thu, 20 Nov 2014 02:38:28 -0500 Received: by mail-pa0-f49.google.com with SMTP id eu11so2010465pac.8 for ; Wed, 19 Nov 2014 23:38:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=FC6zxCFeVAbYAmDUXkHzmhCYllTXN67fKFr1PdjDe3w=; b=C9qyhMDAeRc0sGvexGo5v7k2lLbRSMOBBVnueUB8kWimfMTNdyipjjYVCovGzlVpV9 TxPxgNzJXtjMIQv9eeFvZLhCy2XSQFkZYxkR+6hh5S4ALVMJz+3hITJMfZFvZDP9WwvL 7FwEdVrTMSCLZFj02CG7QEbgkGkLxecDBNo6gY6Th0cBoEJlcwS3ektPhEnBzDChN+es NsLk4srNuT8rw+7yxcgLooqoVp/9i3ocoXtaCck/3zUXF+GEm5jkxYWVtyzrpR5/C6Kr o+Sbhp3xvJKvFOO4c2yNl6TEeW5ExCY6nAnanyOlFOBo3cW962CD2VR3U0+PxqB+9hJq k85A== X-Received: by 10.66.66.42 with SMTP id c10mr34097237pat.4.1416469104939; Wed, 19 Nov 2014 23:38:24 -0800 (PST) Received: from [192.168.2.102] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id dk1sm1201500pdb.48.2014.11.19.23.38.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Nov 2014 23:38:24 -0800 (PST) Message-ID: <546D9A6F.8080106@gmail.com> Date: Wed, 19 Nov 2014 23:38:23 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Yasuo Ohgaki CC: PHP Internals References: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> <546D43B3.60708@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Safe Casting Functions From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Please refer to CWE/SANS TOP 25, Monster Mitigation especially. > > http://cwe.mitre.org/top25/#Mitigations > > and ISO 27000. (I cannot provide link to it, since one should buy the > document to read) Could you please be more specific about how this relevant to this specific case? "But an ISO standard and read it whole" is not exactly a good argument when discussing the specific issue. > Programmer should control over all inputs as the most important security > measure. > There are two strategies in general. > > - Convert inputs to secure values and ignore possible attacks. > (Sanitization) > - Validate inputs to reject malformed values and record possible > attacks. (Validation and logging) Thank you, I am aware of what sanitizing and validating input is. > to_int can be used as validation. It has advantage to record possible > attack (or bug). Logging is > one of important security feature. Therefore, validation could be said > more secure than sanitization. I don't see how it can be said. Logging by itself is not a security feature, and if you need logging, it could be established independently, and should be anyway since to_* log nothing. So claiming to_* is a security feature by itself is like saying fopen() is a security feature by itself because you could use it to open a log file to which you'd write security-relevant data. > Which strategy to adopt is that depends on organization/application > policy. Right. So how can one claim one is more secure than the other? Where is the lack of security? > (int) works mostly What you mean by "mostly"? Could you describe the cases where it does not work and to_* does? -- Stas Malyshev smalyshev@gmail.com