nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

javascript/Security

The common ways JavaScript applications get exploited — and how to prevent it.

10 QuestionsAdvancedHigh Priority ~13 min read

Most client-side JavaScript security issues come down to trusting data that shouldn't be trusted. Cross-Site Scripting (XSS) happens when unsanitized user input gets rendered as HTML or executed as script — directly setting innerHTML with user content is the classic mistake, which is why frameworks like React escape content by default and why dangerouslySetInnerHTML is named the way it is. Cross-Site Request Forgery (CSRF) is a different problem: a malicious site tricks a logged-in user's browser into making a request to your app, relying on cookies being sent automatically.

Defenses map directly to these threats. Content Security Policy (CSP) headers restrict what scripts are allowed to run and from where, meaningfully limiting the damage even if an XSS injection succeeds. CSRF tokens and the SameSite cookie attribute prevent forged cross-site requests from being honored. The Same-Origin Policy underlies most of this — it's the browser's default rule that scripts from one origin can't read data from another, and CORS is the controlled, opt-in mechanism for relaxing that rule when it's actually needed.

What you'll walk away knowing

What XSS is, the difference between stored/reflected/DOM-based variants, and how sanitization prevents it
How CSRF attacks work, and what CSRF tokens and SameSite cookies actually protect against
What Content Security Policy does, and how it limits damage even after a successful injection
How the Same-Origin Policy and CORS relate — one is the default restriction, the other the controlled exception

No questions match "".

All Topics
1
Basics
Data Types
Functions
Objects
2
Engine
JIT
V8
Event Loop and Runtime
Concurrency and Threading
Bytecode and Parsing
Execution Context
Garbage Collector
3
this
Call Apply Bind
Closure
Error Handling
4
String Operations
Array Operations
Iterator and Generator
Modules
5
Events
Promises
Web Workers
Web Sockets
6
Functional Programming
Currying
Higher Order Functions
Memoisation
7
ES6 Classes
ES6
PWA
Web Assembly
Browser APIS
8
Security
Code
Polyfills
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.