From 5a072d8c91a04bca4f2c21748dbedf532fc1b1ad Mon Sep 17 00:00:00 2001 From: aminesbdev Date: Sun, 9 Aug 2026 13:18:58 +0200 Subject: [PATCH] docs: add security and sanitization reference to developer skill --- skills/dev-skills/angular-developer/SKILL.md | 6 + .../angular-developer/references/security.md | 115 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 skills/dev-skills/angular-developer/references/security.md 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 `