Same-origin policy
In computing, the same-origin policy (SOP) is a concept in the web application security model.[src] Under the policy, a web browser permits scripts contained in a first web page to access data in a second web page, but only if both web pages have the same origin.[src] An origin is defined as a combination of URI scheme, host name, and port number.[src] This policy prevents a malicious script on one page from obtaining access to sensitive data on another web page through that page's Document Object Model (DOM).[src] This mechanism bears a particular significance for modern web applications that extensively depend on HTTPS cookies to maintain authenticated user sessions, as servers act based on the HTTP cookie information to reveal sensitive information or perform state-changing actions.[src] A strict separation between content provided by unrelated sites must be maintained on the client-side to prevent the loss of data confidentiality or integrity.[src] The same-origin policy applies only to scripts.[src] This means that resources such as images, CSS, and dynamically loaded scripts can be accessed across origins via the corresponding HTML tags (with fonts being a notable exception).[src] Attacks take advantage of the fact that the same origin policy does not apply to HTML tags.[src] There are some mechanisms available to relax the SOP; one of them is cross-origin resource sharing (CORS).[src]
In computing, the same-origin policy (SOP) is a concept in the web application security model.[src] Under the policy, a web browser permits scripts contained in a first web page to access data in a second web page, but only if both web pages have the same origin.[src] An origin is defined as a combination of URI scheme, host name, and port number.[src] This policy prevents a malicious script on one page from obtaining access to sensitive data on another web page through that page's Document Object Model (DOM).[src] This mechanism bears a particular significance for modern web applications that extensively depend on HTTPS cookies to maintain authenticated user sessions, as servers act based on the HTTP cookie information to reveal sensitive information or perform state-changing actions.[src] A strict separation between content provided by unrelated sites must be maintained on the client-side to prevent the loss of data confidentiality or integrity.[src] The same-origin policy applies only to scripts.[src] This means that resources such as images, CSS, and dynamically loaded scripts can be accessed across origins via the corresponding HTML tags (with fonts being a notable exception).[src] Attacks take advantage of the fact that the same origin policy does not apply to HTML tags.[src] There are some mechanisms available to relax the SOP; one of them is cross-origin resource sharing (CORS).[src] == Corner cases== The behavior of same-origin checks and related mechanisms is not well-defined in a number of corner cases such as for pseudo-protocols that do not have a clearly defined host name or port associated with their URLs (file:, data:, etc.).[src] This historically caused a fair number of security problems, such as the generally undesirable ability of any locally stored HTML file to access all other files on the disk, or communicate with any site on the Internet.[src] Lastly, certain types of attacks, such as DNS rebinding or server-side proxies, permit the host name check to be partly subverted, and make it possible for rogue web pages to directly interact with sites through addresses other than their "true", canonical origin.[src] The impact of such attacks is limited to very specific scenarios, since the browser still believes that it is interacting with the attacker's site, and therefore does not disclose third-party cookies or other sensitive information to the attacker.[src] == Attacks==[src]
25 sentences · 25 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Same-origin policy." encyclopegia.org, 2026, https://encyclopegia.org/wiki/same-origin-policy. Accessed 25 November 2026.
Chicago
"Same-origin policy." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/same-origin-policy.
APA
encyclopegia.org. (2026). Same-origin policy. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/same-origin-policy
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON