liveBook · Manning

Sanitization

Sanitization is the process of checking, modifying, removing, or normalizing data to meet relevant safety, privacy, consistency, or domain requirements before use or sharing.

How 4 Manning books explain it

Machine Learning Platform Engineering

Input sanitation is the validation, filtering, and normalization of externally supplied data before it is processed by a system.

How it is used
Screens public-facing LLM and RAG queries before model calls as the first layer of production safety guardrails.
How deep it goes
Shows validator installation and configuration, then a composed Guardrails AI input guard with distinct repair and rejection actions.
Examples
Uses email redaction and competitor-mention rejection, with a Guardrails AI listing that validates queries and returns sanitized output.
What you can do after
Apply it via Guardrails AI to configure input validators that repair specified PII or reject disallowed mentions before processing.

Read how Machine Learning Platform Engineering explains sanitization →

Shipping Go: Develop, deliver, discuss, design, and go again

Input sanitation is the processing of incoming values to make them uniform and acceptable before further handling.

How it is used
Uses sanitation in a service to make incoming messages more uniform and robust.
How deep it goes
Defines sanitation and demonstrates lowercase and whitespace handling, while leaving the handler’s input path for later examination.
Examples
Tests uppercase words, uppercase languages, and trailing spaces in a Go translation service.
What you can do after
Apply sanitation with Go’s strings package by lowercasing and trimming service inputs.

Read how Shipping Go: Develop, deliver, discuss, design, and go again explains sanitization →

Generative AI in Action

Sanitization is the transformation or removal of unsafe content from input or output before it is processed or rendered.

How it is used
Reduces prompt-injection and insecure-output risks where model inputs or outputs interact with application capabilities.
How deep it goes
Identifies risks and safeguards, but does not specify a sanitization procedure or guarantee prevention.
Examples
Uses an embedded script-tag input and a report request that could generate SQL to drop a database table.
What you can do after
Apply it by validating input and output, using prepared statements, limiting database permissions, and auditing frequently.

Read how Generative AI in Action explains sanitization →

AI Governance

Input sanitization is the modification of supplied data to remove or neutralize content that could violate security or processing requirements.

How it is used
Reduces security, privacy, and processing risks by filtering API payloads and retrieved documents before they cross trust or indexing boundaries.
How deep it goes
Shows sanitization before API calls, after calls, and before indexing, but specifies no algorithms or guarantees of prevention.
Examples
Uses payload validation, sensitive-data anonymization, protected-field encryption, output removal, and stripping hidden document formatting and metadata.
What you can do after
Operate/configure pre-call filters to validate, anonymize, or encrypt payloads and strip hidden formatting and metadata before indexing.

Read how AI Governance explains sanitization →

Also covered in

What to know first

Questions about sanitization

What is sanitization?

Sanitization is the process of checking, modifying, removing, or normalizing data to meet relevant safety, privacy, consistency, or domain requirements before use or sharing.

Which Manning books explain sanitization?

Machine Learning Platform Engineering, Shipping Go: Develop, deliver, discuss, design, and go again, Generative AI in Action and AI Governance.

What should I know before learning sanitization?

Manning books that teach sanitization usually introduce language model, authorization, retrieval-augmented generation and prompt first.

What kinds of sanitization are there?

Kinds of sanitization include anatomization, data perturbation, data suppression and generalization.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.