Home / Learn Secure SQL / How Outside Input Reaches a Query

How Outside Input Reaches a Query

Tracing the path from a web request to a WHERE clause.

Quick summaryTracing the path from a web request to a WHERE clause.

How to think about this

A typical pathHTTP requestroute handlervalidation layerquery built with thevaluedatabase
A typical path

What it is

A value typed into a form, placed in a URL, or sent in an API request body travels through your application's routing and business logic before it ever reaches a line of SQL.

Why it matters

Mapping this path for your own application tells you exactly which lines of code are "the boundary" that need careful handling: every point where outside input is about to be used in a query.

Mechanically speaking

Draw the path once for a feature you own: request -> handler -> validation -> query. Anywhere a value skips the validation step on its way to the query is worth a second look.

Shows up in

  • Web application code review
  • Backend development
  • Database administration

Try it: a value arriving safely as a bound parameter

Simulating a value from a requestSQL: edit and run

Whatever the visitor typed becomes the value of the placeholder, never part of the SQL command itself, no matter what characters it contains.

Check yourself

1. Mapping the path from request to query mainly helps you...