taint analysis

Tracking untrusted data from where it enters (a source) to where it would be dangerous (a sink), unless it passes a sanitiser first.

In more detail

Simple pattern rules only see one expression, so they miss input that flows through several functions. Semgrep's taint mode follows the data instead.

Example

In the course, request.args.get is the source and os.system the sink, and a function that strips one character is still reported because the scanner cannot prove the cleaning is complete.

Related terms

Taught in

References