官方的 MASTR 标志 MASTR 支持这项工作
目录
← 知识库首页

Web 基础

Same-origin policy: the browser's boundary between sites

Scheme, host and port determine which documents share an origin.

Web2 foundation · 1 min read

研究文章和参考条目以英语发布。导航提供七种语言。

人物与项目

本文目录
  1. Why origin matters
  2. The boundary can be weakened
  3. 来源与原始文件

Why origin matters

The same-origin policy restricts how scripts from one origin interact with resources from another. An origin is defined by the scheme, host and port. Changing a path normally leaves the origin unchanged; changing a host or protocol does not.

This prevents an unrelated page from freely reading another site's authenticated data simply because the same browser has both open. Cross-origin embedding and sending requests are not identical to permission to read the response.

The boundary can be weakened

CORS provides a controlled way for servers to allow certain cross-origin reads. A permissive response must be assessed with the endpoint's data and credential handling. A configuration that is reasonable for public assets may be inappropriate for private account data.

The boundary also does not protect an application from scripts it deliberately loads into its own page. A third-party script can become part of the trusted execution environment. Review who can change those dependencies. Connect this to Content Security Policy and wallet-facing page content.

来源与原始文件

相关阅读

MASTR

支持独立研究

这里的调查、原始证据和指南均可免费阅读。自愿捐赠帮助支付研究成本,让 MASTR 能够继续提供工具。

打开钱包