input sanitization
Cleaning input by removing or escaping dangerous parts, such as HTML tags, before storing or displaying it.
In more detail
Validation rejects bad input; sanitization transforms it. Escaping on output, for the place the data is used, is usually more reliable than trying to strip dangerous parts on input.
Example
React escapes text it renders, which prevents most script injection in Next.js pages.Related terms
- validation schema — A description of what valid data looks like, checked by code while the program runs so bad data is rejected at the door.
- cross-site scripting — An attack where hostile script is injected into a trusted web page and runs with that page’s access, for example to read data or cookies.
Taught in
- Serialization Boundaries: Props & Server Guardrails — Next.js 15 & Modern App Router Architecture
- Server Action Security: Zod Validation & Auth Gates — Next.js 15 & Modern App Router Architecture