Type a search term to find related articles by LIMS subject matter experts gathered from the most trusted and dynamic collaboration tools in the laboratory informatics industry.
All user input is to be considered untrusted. Seemingly “trusted/safe” input, like some $_SERVER variables in PHP, can be easily manipulated by attackers.
Escaping or filtering “trusted” input that should not contain any characters that require escaping will only give you a negligible performance penalty, but you will be on the safe side if the input turns out to be untrusted.
Validating input data using a character whitelist can avoid attacks using unexpected characters (null bytes, UTF-8, control characters used as delimiters in internal representations etc.). Ensure your validation is not too strict, for example you will need to allow both UTF-8 and characters like ' in person name fields.
An attacker is not constrained by the constraints a browser puts on him. Just because an input field is specified with maxlength=20
does not mean that an attacker cannot craft a request with 200 KB of data. The same goes for any JavaScript based constraints.
The original source for this page is the associated Wikibooks article and is shared here under the CC BY-SA 3.0 license.