SShortSingh.
Back to feed

Browser Security Model Explained: SOP, CORS, XSS, CSRF and How They Work Together

0
·1 views

Modern web browsers operate as hostile execution environments where untrusted code from one tab can sit dangerously close to sensitive user sessions in another. The browser's security model — built around policies like Same-Origin Policy (SOP) and Cross-Origin Resource Sharing (CORS) — was designed to counter threats such as session hijacking, cross-site scripting, and cross-site request forgery. SOP restricts how scripts from one origin can interact with resources from another, defined by a combination of protocol, host, and port, though it blocks reading responses rather than sending requests, which is why CSRF attacks remain possible. CORS allows servers to deliberately opt in to cross-origin access via HTTP headers, but a common misconfiguration — reflecting any incoming Origin header back without validation alongside credentials — can completely bypass SOP and expose authenticated data. Understanding these security boundaries is considered essential for developers, as attackers routinely exploit gaps in their implementation to steal user data or hijack sessions.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Expo Raises $45M Series B to Accelerate App Development Tools and AI Features

Expo, the mobile app development platform, has raised $45 million in a Series B funding round led by Georgian, which has previously backed developer infrastructure companies such as Replit and Render. Co-founder Charlie Cheever noted that Expo was already profitable and did not need the capital to sustain operations, but chose to raise funds to speed up product development. The company plans to use the investment to hire engineers and build new features that make app creation faster and more accessible. Growing adoption of Expo alongside AI tools has expanded the team's roadmap significantly. Expo also stated a broader ambition to enable non-developers with vision and determination to build application software.

0
ProgrammingDEV Community ·

Developer Builds Static Scanner to Catch Supply-Chain Malware Before Code Runs

A developer created a static repository scanner after being targeted by a fake job interview repo designed to steal credentials and API keys. The tool analyzes repositories without cloning, installing, or executing any code, since malicious scripts embedded in npm lifecycle hooks like postinstall can run automatically during npm install. The scanner checks for three key threat categories: dangerous build-time execution hooks, dependencies in package.json that resolve to unexpected or non-registry URLs in the lockfile, and obfuscation patterns such as eval of decoded strings or long hex literals. The attack that inspired the tool exploited a mismatch between a trusted-looking package name and a malicious tarball URL hidden in the lockfile. By keeping analysis logic free of any I/O and testable against known-malicious fixtures, the scanner can flag suspicious combinations of signals before any harm is done.

0
ProgrammingDEV Community ·

Developer Releases 9 Open-Source Telegram Bot Templates Built in Python

A developer has published nine production-ready Telegram bot templates on GitHub, covering use cases such as AI assistance, appointment booking, crypto price alerts, job listings, and survey collection. The bots are built with Python 3.12 and the aiogram framework, using SQLite for data storage and Anthropic's Claude Haiku model for AI features. A freemium model is implemented across relevant bots, allowing 20 free messages per day with unlimited access for premium users. Supporting tools include APScheduler for scheduled tasks and free APIs such as CoinGecko for cryptocurrency data. All nine templates are freely available on GitHub, and the developer is also offering custom bot development starting at $49 per bot.

Browser Security Model Explained: SOP, CORS, XSS, CSRF and How They Work Together · ShortSingh