Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100384 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20512 invoked from network); 5 Sep 2017 13:44:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2017 13:44:11 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lsces.co.uk designates 185.153.204.204 as permitted sender) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 185.153.204.204 mail4.serversure.net Linux 2.6 Received: from [185.153.204.204] ([185.153.204.204:47458] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/97-04538-72AAEA95 for ; Tue, 05 Sep 2017 09:44:09 -0400 Received: (qmail 19085 invoked by uid 89); 5 Sep 2017 13:44:05 -0000 Received: by simscan 1.3.1 ppid: 19079, pid: 19082, t: 0.0454s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.7?) (lester@rainbowdigitalmedia.org.uk@81.138.11.136) by mail4.serversure.net with ESMTPA; 5 Sep 2017 13:44:05 -0000 To: internals@lists.php.net References: <0C7F986C-B0BC-4315-98ED-B4FD003B9399@gmail.com> Message-ID: <2a4491b4-e6f5-4297-beec-363f373a93e6@lsces.co.uk> Date: Tue, 5 Sep 2017 14:44:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] A validator module for PHP7 From: lester@lsces.co.uk (Lester Caine) On 05/09/17 14:08, lists@rhsoft.net wrote: > > > Am 05.09.2017 um 13:36 schrieb Lester Caine: >> On 05/09/17 12:18, Yasuo Ohgaki wrote: >>> I cannot guess people's thought. I appreciated feedback! >> >> With a decent database layer a lot of the validation you are proposing >> is already covered but PDO does not help in this area. Adding another >> layer that does not integrate with a storage layer is just adding to the >> current mess ... > > sorry, but you confuse "input validation" which this topic is about with > something different - input validation and reject bad requests belongs > some layers on top of any storage and should be done as soon as possible > > that should even happen long before you open a database connection at > all because when you know the request is bad soon enough you won't talk > to any database, filesystem or whatever storage layer at all > > the only question as applicaton developer is how you proceed in which cases > > * reject the whole request with a error-message > * reset form-fields where you don't expect an array as input > * reset from-fields with out-of-range input values > > here you go: > https://en.wikipedia.org/wiki/Data_validation When the database layer provides a complete list of fields and validation rules as part of it's meta data, it is integral to any GOOD process. Copying all that data and manually creating filter rules is just unnecessary work. In addition much of the VALIDATION is best done at the browser end, and building that code is a lot easier when there is a standard validation base across all of the layers! Rejecting crap from hackers that have no format matching the fields on the browser page is something else and if the data set is corrupt then yes you can simply skip out before doing anything with it! But the problem these days is when hackers try injecting things like SQL into fields they think may be able to get through to the database. Provided that the validation layer can properly filter that injection requires knowledge that a string has reason to be rejected. Just as simply type casting a number to integer or float is only doing a small part of the job. Typing and validating a field by the metadata constraints has to be the right way forward? -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk