What is Same origin policy ? Why you should know about SOP ?
同源策略(SOP)是浏览器的安全机制,限制不同网站脚本间的交互。它通过协议、域名和端口判断资源是否来自同一来源。若来源不同,则禁止脚本访问或操作其他网站的数据和资源。 2025-8-1 04:16:43 Author: infosecwriteups.com(查看原文) 阅读量:21 收藏

Ayush Kumar

Ever heard the phrase “curiosity killed the cat”? The web’s kind of like that sometimes — curious scripts love to poke their noses where they don’t belong. Luckily, the Same-Origin Policy (yep, it’s a mouthful) is there to keep things in check.

Zoom image will be displayed

So if you’ve ever wondered why some websites can’t “just” talk to each other, or how hackers try to bypass these rules, pull up a chair. Let’s peel back the curtain on one of the unsung heroes of web security…with a few sneak peeks into its weak spots, too.

Think of your web browser as a bouncer at a club. Every page and script has to show ID before it can mingle. The Same-Origin Policy (SOP) is the browser’s rulebook: scripts loaded from one “origin” can only interact with stuff from the same origin.

But what’s an “origin”? It’s a combo of:

  • Protocol (http or https)
  • Domain
  • Port

Example:

  • https://myblog.com:443/home
  • https://myblog.com:443/aboutSame origin (all three match).
  • http://myblog.com:443/homeDifferent origin (protocol changed).
  • https://myblog.com:8080/home

文章来源: https://infosecwriteups.com/what-is-same-origin-policy-why-you-should-know-about-sop-36ef803b4732?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh