# Segurança e boas práticas (Angular) > XSS protection, CSRF, sanitization, DomSanitizer, Content Security Policy, authentication, authorization, JWT - 20 perguntas de entrevista - Senior - [Perguntas de entrevista: Angular](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista.md) ## 1. O que é um ataque XSS (Cross-Site Scripting)? **Resposta** Um ataque XSS consiste em injetar código JavaScript malicioso em uma aplicação web para executá-lo nos navegadores dos usuários. O atacante explora falhas de validação para roubar dados sensíveis (cookies, tokens) ou manipular o DOM. Angular protege automaticamente contra esse tipo de ataque por meio da sanitization do conteúdo injetado nos templates. ## 2. Como o Angular protege automaticamente contra ataques XSS? **Resposta** O Angular sanitiza automaticamente todos os valores injetados nos templates via interpolação ou property binding. O DomSanitizer analisa o conteúdo e remove qualquer código potencialmente perigoso antes de exibi-lo. Essa proteção é aplicada por padrão sem configuração adicional, garantindo que HTML, URLs e estilos não confiáveis sejam limpos. ## 3. O que é o DomSanitizer no Angular? **Resposta** DomSanitizer é um serviço do Angular que limpa o conteúdo não confiável antes de injetá-lo no DOM. Ele analisa HTML, URLs, estilos e scripts para detectar e remover elementos potencialmente perigosos. Este serviço também fornece métodos bypassSecurityTrust* para marcar explicitamente o conteúdo como seguro quando a fonte é confiável e verificada. ## Mais 17 perguntas disponiveis - Em quais contextos o Angular aplica a sanitization automática? - O que é um ataque CSRF (Cross-Site Request Forgery)? Cadastre-se gratis: https://sharpskill.dev/pt/login ## Outros temas de entrevista Angular - [Fundamentos do TypeScript](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/typescript-basics.md): 25 perguntas, Junior - [TypeScript Avançado](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/typescript-advanced.md): 20 perguntas, Junior - [Fundamentos do Angular](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/angular-fundamentals.md): 20 perguntas, Junior - [Componentes e ciclo de vida](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/components-lifecycle.md): 20 perguntas, Junior - [Services & Dependency Injection](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/services-dependency-injection.md): 20 perguntas, Junior - [Organização de Módulos Angular](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/modules-organization.md): 22 perguntas, Mid-Level - [Angular CLI](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/angular-cli.md): 18 perguntas, Junior - [Diretivas e Pipes](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/directives-pipes.md): 22 perguntas, Mid-Level - [Routing e Navegação](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/routing-navigation.md): 24 perguntas, Mid-Level - [Formulários reativos](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/forms-reactive.md): 26 perguntas, Mid-Level - [Formulários template-driven](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/forms-template-driven.md): 16 perguntas, Mid-Level - [Fundamentos do RxJS](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/rxjs-fundamentals.md): 22 perguntas, Mid-Level - [Operadores RxJS](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/rxjs-operators.md): 24 perguntas, Mid-Level - [HttpClient e chamadas de API](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/http-client.md): 22 perguntas, Mid-Level - [Gerenciamento de estado básico](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/state-management-basics.md): 20 perguntas, Mid-Level - [Change Detection](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/change-detection.md): 20 perguntas, Mid-Level - [Angular Signals](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/angular-signals.md): 20 perguntas, Mid-Level - [Standalone Components](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/standalone-components.md): 18 perguntas, Mid-Level - [Testes unitários em Angular](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/testing-unit.md): 22 perguntas, Mid-Level - [Testes End-to-End](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/testing-e2e.md): 18 perguntas, Mid-Level - [Build e otimização](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/build-optimization.md): 20 perguntas, Mid-Level - [Fundamentos do NgRx](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/ngrx-fundamentals.md): 24 perguntas, Senior - [NgRx avançado](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/ngrx-advanced.md): 24 perguntas, Senior - [Arquitetura Angular](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/angular-architecture.md): 22 perguntas, Senior - [Otimização de desempenho](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/performance-optimization.md): 22 perguntas, Senior - [Padrões avançados de RxJS](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/advanced-rxjs-patterns.md): 22 perguntas, Senior - [Angular Universal e SSR](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/angular-universal-ssr.md): 20 perguntas, Senior - [Micro-frontends Angular](https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/micro-frontends-angular.md): 20 perguntas, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/pt/technologies/angular/perguntas-entrevista/security-best-practices