Sanitization
Last updated
What is Sanitization?
Sanitization is the inspection of an untrusted value, turning it into a value that's safe to insert into the DOM. In many cases, sanitization doesn't change a value at all. Sanitization depends on context: A value that's harmless in CSS is potentially dangerous in a URL.
Angular sanitizes untrusted values for HTML and URLs. Sanitizing resource URLs isn't possible because they contain arbitrary code. In development mode, Angular prints a console warning when it has to change a value during sanitization.
Free resources to learn Sanitization
- Official docsSanitization and Security Contexts
More in stage 18: Developer Tools
- Developer Tools
- Angular CLI
- DevTools
- Local Setup
- Language Service
- Deployment
- Libraries
- End-to-End Testing
- Using Libraries
- Schematics
- Creating Libraries
- Build Environments
- Cross-site Scripting
- HTTP Vulnerabilities
- CLI Builders
- Cross-site Request Forgery
- AoT Compilation
- Trusting Safe Values
- HttpClient CSRF
- Enforce Trusted Types
- XSRF protection
- Cross-site Script Inclusion
- NGXS
- NgRx
- RxJS Interop
- Inputs as Signals
- Queries as Signals
- Model Inputs
Sanitization: common questions
Can I learn Sanitization in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Sanitization in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Sanitization tutorial for beginners?
It is lesson 109 of 158 in the free Angular roadmap, in stage 18, Developer Tools. If you are new to Angular, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.