Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95121 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60903 invoked from network); 13 Aug 2016 17:02:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2016 17:02:15 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.230 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.230 mail4-3.serversure.net Linux 2.6 Received: from [217.147.176.230] ([217.147.176.230:39121] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/F3-36656-6925FA75 for ; Sat, 13 Aug 2016 13:02:15 -0400 Received: (qmail 13508 invoked by uid 89); 13 Aug 2016 17:02:11 -0000 Received: by simscan 1.3.1 ppid: 13502, pid: 13505, t: 0.0909s 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; 13 Aug 2016 17:02:10 -0000 To: internals@lists.php.net References: <10fbcb03-5de8-4d9a-da1c-7e2bf77937cb@lsces.co.uk> Message-ID: Date: Sat, 13 Aug 2016 18:02:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Simple variable handling. From: lester@lsces.co.uk (Lester Caine) On 13/08/16 14:43, Marco Pivetta wrote: > It receives a value (nested, if necessary) and tells us if it is valid or > not, plus why (as a set of strings, usually). > > This is validation. Please do use separate terminology if you mean: > * "frontend (client-side) validation" > * "frontend (server-side) validation" > * "domain validation" > > Even more specific if you are going with something different, please. Not quite sure what you are referring to by 'domain validation' all *I* am talking about is the process of obtaining a valid set of data to store in a database. Nothing more. That is a set of variables with a little more complex rules than the simple 'int' or 'string' type checking that has caused so much trouble. There are many useful well defined strings such as email address, National Insurance Number Bank sort code and so on which have well defined rules against which to validate the data supplied. An NI Number is a fixed well defined string that does not need escaping when displayed, but may in some cases need masking if the client user does not have full access. Most systems will actually be used by real people who expect the client side to be fast, so passing those rules client side is part of a process to handle variables. The same rules are used server side to validate the dataset and when there are no morons around the server side should have to do little more than rubber stamp the various variables in the post data. Additional checks are normally added server side such as if an NI number already exists, or a valid postcode has been supplied. Something which could also be actioned via an AJAX check. Nowadays even inside PHP the gap between client and server is somewhat woolly ? and this is where access on a variable by variable basis to the rules is essential. But we do have morons around who take pleasure in trying to make life difficult for everybody else. They will capitalise on any known weakness to try and mess sites up. That the validation process has to be robust enough to cope with this sort of activity IS a different problem, but with a robust variable based validation, injections should be difficult to push through and apart from the previous discussions on being able to store examples of malicious code while avoiding it also being able to be activated, my preferred workflow ensures that validation includes elimination of any potentially malicious code. -- 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