Skip to main content

XSS, CSRF, CSP and Angular sanitization

Learn XSS, CSRF, CSP and Angular sanitization (Module 16 · Authentication and Security, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Attacks in plain language • Cross-Site Scripting (XSS) : an attacker gets their JavaScript to run on your page (for example inside a comment you display). It then runs with the user's powers: reads data, calls APIs, steals tokens in localStorage. • Cross-Site Request Forgery (CSRF) : the attacker's site tricks your browser into sending a request to your bank; because the browser attaches your cookies automatically , the bank thinks it was you. CSRF only matters when authentication relies on cookies, not on a manually attached Bearer header. • Content Security Policy (CSP) : a response header...

More lessons in Module 16 · Authentication and Security