This covers the core security patterns you need when building Angular apps, from XSS prevention and CSRF protection to Content Security Policy setup. You get practical examples of DomSanitizer usage, HttpClient CSRF configuration, and router guards for authentication. It's updated for Angular 21 with newer features like Trusted Types support and the provideZoneChangeDetection security options. The examples are straightforward and show both the dangerous patterns to avoid and the safe alternatives. If you're handling user input, third-party content, or need to lock down routes, this gives you the essential patterns without drowning you in theory.

skills.sh installs
211
GitHub stars
7
last updated
Aug 21, 2026

Install

$ npx -y skills add oguzhan18/angular-ecosystem-skills --skill angular-security --agent claude-code

Installs into .claude/skills of the current project.

Files

Angular Security

Version: Angular 21 (2025) Tags: Security, XSS, CSRF, CSP, Sanitization

References: Security Guide • DomSanitizer

API Changes

This section documents recent version-specific API changes.

  • NEW: Trusted Types — Angular supports Trusted Types for CSP

  • NEW: HttpClient CSRF — Built-in CSRF protection with CookieXSRFStrategy

  • NEW: provideZoneChangeDetection with untrustedEvents — Zone.js event filtering

  • NEW: afterNextRender security — Run code safely after rendering

Best Practices

  • Use DomSanitizer for safe HTML
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';

constructor(private sanitizer: DomSanitizer) {}

getSafeHtml(html: string): SafeHtml {
  return this.sanitizer.bypassSecurityTrustHtml(html);
}
  • Use bypassSecurityTrust methods carefully

Sponsors

Details

Repository
github.com/oguzhan18/angular-ecosystem-skills
Categories
Frontend Development, Security
First seen
Jun 3, 2026

More from oguzhan18/angular-ecosystem-skills

All 45
1microsoft avatarwinui-ui-testingmicrosoft/win-dev-skillsAutomated UI testing for WinUI 3 apps — generate a batch test script, run all tests in one pass, read results. Covers element assertions, interactions, value ch201skills.sh installs
2charleswiltgen avataraxiom-ui-testingcharleswiltgen/axiomUse when writing UI tests, recording interactions, tests have race conditions, timing dependencies, inconsistent pass/fail behavior, or XCTest UI tests are flak199skills.sh installs
3dralgorhythm avatarreact-native-reanimateddralgorhythm/claude-agentic-frameworkReact Native Reanimated 4.x animation patterns. Use when adding animations, transitions, entering/exiting effects, or gesture-driven animations to React Native 199skills.sh installs
4oguzhan18 avatarangular-animationsoguzhan18/angular-ecosystem-skillsConfigure Angular animations with triggers, transitions, keyframes, and reusable animation functions. Use when working with Angular enter/leave animations, UI t194skills.sh installs
5oguzhan18 avatarangular-i18noguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular i18n, internationalization, localization, translations, or multi-language support in Angular applications.194skills.sh installs
6oguzhan18 avatarangular-servicesoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular Services, @Injectable, dependency injection, or business logic services.193skills.sh installs