However, the problem is much more general. These tests should usually be centralized in one place so that the validity tests can be easily examined for correctness later. If there's a relevant standard, look at it, but also search to see if the program has extensions that you need to know about. See the section called Minimize Privileges in Chapter 6 for more information on minimizing privileges. Not all inputs are under the control of an untrusted user, so you need only worry about those inputs that are.
Many programs use the command line as an input interface, accepting input by being passed arguments.