Validating form php

Beyond the perimeter is everything considered potential enemy territory which is...literally everything other than the literal code executed by the current request.All possible entrances and exits on the perimeter are guarded day and night by trigger happy sentries who prefer to shoot first and never ask questions.Each of these allies have their own perimeters which may or may not trust ours. As noted in the Introduction, we trust nothing and nobody.

Connected to this perimeter are separately guarded (and very suspicious looking) “allies” including the Model/Database and Filesystem.Nobody wants to shoot them but if they press their luck..Even where we do appear to have gotten it down, we’ll need to be concious of the following considerations.You should bear these in mind whenever implementing custom validators or adopting a 3rd party validation library.It’s also worth bearing in mind that PHP is not above some bizarre arguably unsafe behaviours.

Consider the following example from PHP’s filter functions: The above example passes the filter without issue.

This is one of those compartmentalising by trust value issues I mentioned.

In suggesting that users are untrusted, we imply that everything else is trusted. Users are just the most obvious untrusted source of input since they are known strangers over which we have no control.

This is the sort of generic validation approach we should seek to avoid at all costs.

Validating input is intended to prevent the entry of unsafe data into the web application.

The outcome of this is that input validation is inherently unreliable.