Backend, Data & Security Core A1 · Official standard Platform: Web

Same-Origin Policy

The Same-Origin Policy is a browser safety rule. It limits how a page or script from one origin can read or work with data from another origin.

See how it works
You might call it SOPorigin isolation

See how it works

Original worked exampleSame-Origin Policy

Another example

A script on `reports.example` cannot read a user's inbox at `mail.example`. The browser can still send cookies there. A planned cross-origin Analytics API returns one exact `Access-Control-Allow-Origin` and no credentials. Window messages are accepted only after checking `event.origin` and the message shape.

Main parts

  1. 01Source origin
  2. 02Target origin and resource
  3. 03Read/interaction restriction or explicit grant

Use it when

Treat each origin as a basic browser safety boundary. When sharing is needed, create clear CORS or `postMessage` access with the least permission.

Do not use it when

SOP does not stop all cross-site requests, navigation, embedding, CSRF, or side channels. Its main job is to limit reading and interaction.

Name used in code

origin tuple (scheme, host, port) + controlled CORS/postMessage exceptions

Before you ship

Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.

Request you can copy

Outcome: Design or review Same-Origin Policy for this system while keeping data correct, secure, and easy to operate. User context: A script on `reports.example` cannot read a user's inbox at `mail.example`. The browser can still send cookies there. A planned cross-origin Analytics API returns one exact `Access-Control-Allow-Origin` and no credentials. Window messages are accepted only after checking `event.origin` and the message shape. Technical concept or control: Same-Origin Policy. Why it fits: Treat each origin as a basic browser safety boundary. When sharing is needed, create clear CORS or `postMessage` access with the least permission. Do not use it when: SOP does not stop all cross-site requests, navigation, embedding, CSRF, or side channels. Its main job is to limit reading and interaction. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): The standard covers only the listed scope. It does not choose the visual style, product decision, or Vibulary example. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.

Check this request

Review the current use of Same-Origin Policy. Definition: The Same-Origin Policy is a browser safety rule. It limits how a page or script from one origin can read or work with data from another origin. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.

A1
How official is this term?

Official standard

A named standard sets the rules described on this page.

The standard covers only the listed scope. It does not choose the visual style, product decision, or Vibulary example.

Scope
HTML origin model and cross-origin restrictions
Document status
living standard
Checked on
2026-07-30

Evidence sources & scope

Authority source + Term reference · WHATWG · living standard HTML: Origins — Relaxing the same-origin restriction Relaxing the same-origin restriction Scope: Web origin model; direct scope: Relaxing the same-origin restriction Role here: Direct term reference Source covers: canonical name, definition, semantics, implementation Authority source · WHATWG · living standard HTML: Origins Origins Scope: Web origin model Role here: Authority within stated scope Source covers: canonical name, definition, semantics, implementation Authority source · WHATWG · living standard Fetch Standard Scope: Web requests and CORS Role here: Authority within stated scope Source covers: canonical name, definition, semantics, implementation

Copy it yourself

The browser could not copy this. Select the request below and copy it yourself.