How does Same Origin Policy apply to browser extensions?

后端 未结 1 1779
面向向阳花
面向向阳花 2020-12-03 16:02

Given a browser extension that sends information from one webpage to an entirely different server, is this violating the same origin policy?

相关标签:
1条回答
  • 2020-12-03 16:02

    The same-origin policy (SOP) appplies to ordinary web pages, not browser extensions, even if they are written in JavaScript. What does "different server" mean when the extension code does not origingate from a server? (The extension script might have some kind of orgin, like chrome-extension://longhashidentificationstr, but not an traditional domain/origin.) To communicate with any Web page (except those that have CORS headers), the extension cannot be bound by the SOP.

    Extensions don't exactly "violate" the SOP; instead, the SOP does not apply to them. The SOP is designed to limit damage that can be caused by a compromised or malicious Web page. Viewing a web page should require zero trust in the page, since it is so easy to visit a Web page. However, installing an extension is something users do less frequently and has larger impact on the user, so it's not unreasonable to require some trust in the extension.

    0 讨论(0)
提交回复
热议问题