Question Bank · Section 14
Security in React
10 questions. XSS, CSRF, token storage, clickjacking, CSP, secure auth flows and avoiding data leaks in React apps.
React escapes output by default, but that does not make an app secure. Interviewers use these questions to see whether you understand where the browser trust boundaries are: what React protects for you, what it does not, and which defenses must live on the server.
01What is XSS (Cross-Site Scripting) and how do you prevent it in React?02What is CSRF (Cross-Site Request Forgery) and how do you mitigate it?03How do you securely store JWT tokens in a React app?04What are the risks of storing tokens in localStorage/sessionStorage?05How do you prevent clickjacking attacks in React apps?06Explain Content Security Policy (CSP) and its role in React security.07How do you handle user input safely in React forms?08How do you implement secure authentication and token refresh flow in React?09What is the difference between HttpOnly and Secure cookies?10How do you prevent sensitive data leaks in client-side logs or error messages?