I know you should always use taint when taking data in from a web app, because somewhere down the road that data or data derived from that data might go into a database or a shell script or backticks or something dangerous. Right.
Question (more theory than practice): if you are 100% certain some data from a cgi arg is never going anywhere dangerous, does untainting really do anything? Say you take a value from a scipt, 'action', and the code does one of three actions based on the value, and has a fallthru 'unknown action attempt' mode. (And the actions are explicit and hardcoded, not &{$action}(@args) insanity, so hacking the form doesn't do anything but get you an unknown mode error.)
I'm sure the right answer is use taint nonetheless -- healthy paranoia -- but I am wondering.
I suppose it's always a good practice to enable taint checking. It provides another layer of security. Also, in reality, most CGI programs are large or will get large eventually and as a result, you can never be 100% certain whether your code is secure.
No, nothing constructive, if you are CERTAIN about your input.
Aye, there's the rub. You may be certain about your input today. How about 6 months from now? How about after the next person mods the app?
Better safe than sorry. Untaint it, even if you "know" it doesn't need it.
perlmonks.org content © perlmonks.org and husker, kiat, tilly, water
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03