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.
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
- 01Source origin
- 02Target origin and resource
- 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.
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.