When do you trust the data / variables
Posted
by Wizzard
on Stack Overflow
See other posts from Stack Overflow
or by Wizzard
Published on 2010-05-22T01:27:08Z
Indexed on
2010/05/22
1:30 UTC
Read the original article
Hit count: 287
We all know that all user data, GET/POST/Cookie etc etc needs to be validated for security.
But when do you stop, once it's converted into a local variable?
eg
if (isValidxxx($_GET['foo']) == false) {
throw InvalidArgumentException('Please enter a valid foo!');
}
$foo = $_GET['foo'];
fooProcessor($foo);
function fooProcessor($foo) {
if (isValidxxx($foo) == false) {
throw Invalid......
}
//other stuff
}
To me thats over the top. But what if you load the value from the database...
I hope I make sense :)
© Stack Overflow or respective owner