untrusted input

Any data a program did not create itself, including arguments, form fields, request bodies, file contents, file names and environment variables.

Scripts that act on untrusted input without care can be steered into deleting or running the wrong thing.

In more detail

Treat it as data only and check it against what you expect, such as a known set of values, rather than trying to strip out dangerous characters. Never assume its size or shape: cap how much you read and treat parse failures as errors. Most injection and resource-exhaustion attacks exploit code that trusted such input.

Examples

Go: wrap readers in io.LimitReader and decode into typed structs
The rule of the course is that anything the caller controls is not evidence of the caller's rights and must stay data when it reaches an interpreter.

Related terms

Taught in

References