diff --git a/skills/dev-skills/angular-developer/SKILL.md b/skills/dev-skills/angular-developer/SKILL.md index 6ab0e3d77009..f36be38cee9d 100644 --- a/skills/dev-skills/angular-developer/SKILL.md +++ b/skills/dev-skills/angular-developer/SKILL.md @@ -67,6 +67,12 @@ When communicating with backend services, use Angular HTTP APIs and consult the - **HTTP Client and Resources**: `provideHttpClient`, `HttpClient`, interceptors, and `httpResource`. Read [http-client.md](references/http-client.md) +## Security + +When securing your application and rendering dynamic content safely, consult the following reference: + +- **Security and Sanitization**: Context-based sanitization, bypassing security with `DomSanitizer`, safe pipes, and Trusted Types. Read [security.md](references/security.md) + ## Forms In most cases for new apps, **prefer signal forms**. When making a forms decision, analyze the project and consider the following guidelines: diff --git a/skills/dev-skills/angular-developer/references/security.md b/skills/dev-skills/angular-developer/references/security.md new file mode 100644 index 000000000000..ae9587f35fab --- /dev/null +++ b/skills/dev-skills/angular-developer/references/security.md @@ -0,0 +1,115 @@ +# Security and Sanitization + +Angular provides built-in protection against Cross-Site Scripting (XSS) attacks. By default, Angular treats all values as untrusted and automatically sanitizes them before inserting them into the DOM. + +--- + +## Context-Based Sanitization + +Angular automatically detects the context in which a value is bound and applies the appropriate sanitization: + +- **HTML**: Used when binding to innerHTML (`[innerHTML]="value"`). Angular strips unsafe elements (such as `