[4] 同一起源ポリシーは、 Web において、スクリプトが異なる起源 (URL scheme、ホスト、ポートの組など) に由来する物体に対してアクセスすることを制限するセキュリティーに関する大原則です。
[56] Webアプリケーションは、鯖が提供したスクリプト等を Webブラウザー上の環境において実行、 評価するものですが、適切なセキュリティー・モデルが無ければ利用者やその他の人が意図しない有害な動作がなされてしまうかもしれません。 同一起源方針は Webブラウザー上で動作するWebアプリケーションのためのセキュリティー・モデルとして発展、収束してきたものです。 RFC 6454 で Adam Barth は次の基本原理をまとめています。
[60] あらゆる URL にそれぞれ個別の保護された領域を与えることもできますが、 それでは実用上不便なので、同一起源方針にあってはドメインなどが共通する URL 群を 起源 (origin) と呼び、これを保護の単位とします。
[61] 例えば http://example.com/
と http://example.com/~mypage/
は http://example.com
という共通の起源を持ちます。しかし
http://www.example.com/
や http://example.com:8080/
の起源はそれぞれ
http://www.example.com
や http://example.com:8080
であり、異なります。
[62] 起源が同じであっても、資源はそれぞれの権限 (authority) を持っています。 どれだけの権限を与えるかは MIME型により決まります。
[64] 同一起源方針においては起源はそれぞれ別に管理されており、他の起源との通信は制限されています。 他の起源のAPIアクセスは原則として禁止されていますし、他の起源の資源を読み取ることもできません。 他の起源に情報を送ることは認められていますが、一部の決められた形式に制限されています。
[18] 一見セキュリティーに関わりそうな次の要素は、起源の定義には含まれていませんから、 同一起源ポリシーの保護対象外です。
[152] 例えば同じ起源の一部のページは認証不要で公開されており、
他のページはHTTP認証により保護されているとします。
まず保護されたページに認証つきでアクセスし、 localStorage
に何らかのデータを保存します。
次に認証不要なページに認証つきでアクセスし、 localStorage
を参照すると、
前に保存したデータが得られます。
なぜなら、 localStorage
は起源単位のストレージであり、
認証の有無は起源の違いとならないからです。
[153] これが問題となるかどうかは、アプリケーションの性質に依存します。 問題となるのであれば、 (Webブラウザーのセキュリティーホールではなくアプリケーション設計の問題なので) 著者が対策を検討しなければなりません。
[9] いくつかの挙動はそれが同じ起源に対して行われた操作に由来するか否かによって変化します。 一般に他の起源の状態や処理結果は取得できません。
window
や location
のメンバー (一部例外を除きます。) に対するスクリプトからのアクセス
HTML 5name
や status
にアクセスできます。
name
の項を参照。)Window
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#security-2Location
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#security-3frameElement
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#dom-frameelementcontentDocument
:
HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#dom-iframe-contentdocument
HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#dom-object-contentdocument
HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#dom-frame-contentdocumentgetSVGDocument
XMLHttpRequest
による外部資源へのアクセス
XMLHttpRequest, XMLHttpRequest 2document.load
document()
関数による別起源の資源へのアクセス 仕様なしmozIsLocallyAvailable
onerror
[Window
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#runtime-script-errorsiframe
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#the-iframe-elementseamless
canvas
の起源汚染autofocus
HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#attr-fe-autofocusping
属性で指定された URL
に対して Ping-From:
ヘッダーを送信するかどうかContent-Type
メタデータの扱い HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#link-type-stylesheetpushState
/replaceState
javascript:
URL: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#javascript-protocolregisterProtocolHandler
, registerContentHandler
:
HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#custom-handlersIsSearchProviderInstalled
:
HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#dom-external-issearchproviderinstallednew Worker
new SharedWorker
sessionStorage
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#the-sessionstorage-attributelocalStorage
: HTML Standard ( 版) http://www.whatwg.org/specs/web-apps/current-work/#the-localstorage-attributeunload
中の navigationPerformanceTiming
から値を取得できるか否かerror
イベントが発火するかどうか HTML[129] Widget
の preferences
にも同一起源ポリシーが適用されます。
[115] 起源が三項組であるか固有識別子であるか、あるいはその三項組がどのような値であるかによって、 挙動が変わることがあります。
Referer:
を送出する条件document.cookie
を使える条件document.cookie
には読み書きできません >>69。WebSocket
[10] 次の機能を使うと、同一起源ポリシーは適用されず、 他の起源のデータに (ある程度) アクセスできます。
src
属性、
object
要素、
embed
要素、
link
要素などによる外部資源の埋め込みimg
要素や iframe
要素などscript
要素による外部スクリプトの参照も含みます。
JSONP などで同一起源方針を擦り抜けるテクニックとしてよく利用されています。@import
による外部 CSS スタイル・シートの輸入postMessage
メソッドを使うと、
異なる起源の Web頁に対してメッセージを伝達できます。marginwidth
などフレーム内の余白を設定する属性を使うと、
フレーム集合文書とは異なる起源のフレーム内文書の余白を設定できます。window.name
marginheight
, marginwidth
EventSource
WebSocket
: 異なる起源でも接続できます。
実際に WebSocket接続を確立することを認めるかどうかは、WebSocketサーバーが判断できます。allowfullscreen
/allowusermedia
history.index
/ history.length
-moz-binding
特性による外部 XBL 1.0
文書の読み込み[138] ここに挙げたものの他、起源とは異なるものを適用対象の範囲とする機能もいくつかあります。 詳しくは起源の「起源と適用範囲が異なる機能」の項を参照。
document.domain
DOM属性に値を設定することにより、
起源となるドメイン名を変更することができます。XMLHttpRequest
でのアクセスを可能にする allowcrossdomainxhr
属性を実装しています。globalStorage
[136] Firefox拡張は拡張 (chrome:
) から内容
(browser
の閲覧文脈) にアクセスでき、
同一起源ポリシー無く操作できます。拡張から内容内の節点で
DOMイベントを dispatch して、情報を伝えることがあります。
[137] ブラウザー拡張によっては内容スクリプトを拡張から内容に注入できることがあります。 拡張と内容スクリプトで通信する手段を提供していることもありますが、 それ以外での両者間のアクセスは制限されています。
[30] Re: Same-origin checking for media elements (Ian Hickson <ian@...> 著, 版) http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/16571
[27] HTML5 は局所ファイルに関しては相互運用性に関係しないため適用範囲外として規定していません。
[28] Chromeセキュリティモデル、IE/Firefox/Safari/Operaのいいとこ取り | エンタープライズ | マイコミジャーナル (Mainichi Communications Inc. 著, 版) http://journal.mycom.co.jp/news/2008/12/08/031/
[29] Chromium Blog: Security in Depth: Local Web Pages ( 版) http://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html
[6] 同一起源方針は、 Netscape Navigator 2.0 で JavaScript と共に導入され >>1、>>2、2.01 および 2.02 で不具合の修正がなされました >>1。
[7] Internet Explorer をはじめとする他ブラウザも同様にこの制限を実装しましたが、 ECMAScript 仕様や DOM 仕様としての標準化の対象外とされ、 長らく明文化された規定が存在していませんでした。
[165] 暗黙の標準だった時期の同一起源ポリシーは、実装ごとに細かな違いがありました。
例えばポートを起源の区別に寄与させるかどうかは、
現在の document.domain
やクッキーの適用範囲にも影響を残しています。
Internet Explorer のセキュリティーゾーンのように、
同一起源ポリシーの原則から外れた機能も存在していました。
[172] Cross-Frame Scripting and Security, InetSDK, , https://web.archive.org/web/20001118034900/http://msdn.microsoft.com/workshop/Author/om/xframe_scripting_security.asp
[8] HTML DOM に関係する部分はようやく2005年頃に WHATWG によって HTML 5 仕様の一部として仕様の明文化が行われ始めました。 また、 XMLHttpRequest に関しては HTML 5 仕様を参照する形で規定されています。
[126] Document
は、当初はオブジェクトそのものは取得できるものの、
そのメンバーは一切読み書きできないとなっていましたが、 contentDocument
などが異なる起源の場合 null を返すよう変更され、異なる起源の Document
オブジェクトにアクセスすること自体ができなくなりました。
[24] 起源に関する基本的な規定は RFC 6454 となりましたが、2014年に HTML Standard、URL Standard、Fetch Standard により廃止されています。
[2]
JavaScript Security: Same Origin (2008-06-18 04:13:16 +09:00
版) http://www.mozilla.org/projects/security/components/same-origin.html
[1]
Same origin policy - Wikipedia, the free encyclopedia (2008-07-02 01:06:45 +09:00
版) http://en.wikipedia.org/wiki/Same_origin_policy
[35] Same origin policy for JavaScript - MDC ( 版) https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript
[36] The Multi-Principal OS Construction of the Gazelle Web Browser - Microsoft Research ( 版) http://research.microsoft.com/apps/pubs/default.aspx?id=79655
Webブラウザーのプロセスを起源毎に分離することによって保安性の向上を図る論文だそうです。
[40] (X)HTML5 Tracking ( 版) http://html5.org/tools/web-apps-tracker?from=4041&to=4042
[41] IRC logs: freenode / #whatwg / 20100223 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20100223
[42] [whatwg] Canvas 2D Context Proposal: resetOriginClean ( 版) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-April/026006.html
[45] Guidelines for Web Content Transformation Proxies 1.0 ( ( 版)) http://www.w3.org/TR/2010/NOTE-ct-guidelines-20101026/#term-same-origin
[46] Web Applications 1.0 r5873 Make sure cross-origin fonts can't leak data via <canvas>. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=5872&to=5873
[47] Embedder's Guide - V8 JavaScript Engine - Google Code ( ( 版)) http://code.google.com/intl/ja/apis/v8/embed.html
[48] draft-abarth-principles-of-origin-00 - Principles of the Same-Origin Policy ( 版) http://tools.ietf.org/html/draft-abarth-principles-of-origin-00
[49] Thoughts on font linking and embedding ( (Maciej Stachowiak 著, 版)) http://lists.w3.org/Archives/Public/public-webfonts-wg/2011Feb/0066.html
[50] Thoughts on font linking and embedding ( (Maciej Stachowiak 著, 版)) http://lists.w3.org/Archives/Public/public-webfonts-wg/2011Feb/0066.html
[51] [whatwg] Canvas and drawWindow ( 版) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-March/030862.html
[52] IRC logs: freenode / #whatwg / 20110202 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20110202
[53] IRC logs: freenode / #whatwg / 20110214 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20110214
[54] クロスドメイン通信方法のまとめ - nopnopの日記 ( ( 版)) http://d.hatena.ne.jp/nopnop/20080408/1207669947
[110] [whatwg] Need to define same-origin policy for WebIDL operations/getters/setters ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-January/038529.html
[117] Web Applications 1.0 r7975 Make showModalDialog()'s dialogArguments and returnValue only be useful same-origin, to avoid origins attacking each other ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7974&to=7975
[118] Web Applications 1.0 r7975 Make showModalDialog()'s dialogArguments and returnValue only be useful same-origin, to avoid origins attacking each other ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7974&to=7975
[119] [whatwg] Adding crossorigin="" to more elements ( ( 版)) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039752.html
[120] Web Applications 1.0 r7997 Block enumeration of cross-origin objects, and clean up the language around those objects to be more consistent so that differences can more easily be seen. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=7996&to=7997
[121] Web Applications 1.0 r8090 Remove the weird stuff around document.domain and localStorage. It doesn't really do anything anyway. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8089&to=8090
[122] Web Applications 1.0 r8196 Add warning notes to the Security sections of Location and Window since they are in flux with no end in sight. ( ( 版)) http://html5.org/tools/web-apps-tracker?from=8195&to=8196
[123] IRC logs: freenode / #whatwg / 20130925 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20130925
[130] Web Applications 1.0 r8713 getSVGDocument() ( ( 版)) http://html5.org/r/8713
[72] Same-origin policy - Web security | MDN ( ( 版)) https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
[131] 524223 – (CVE-2010-0654) Cross-domain data theft using CSS ( 版) https://bugzilla.mozilla.org/show_bug.cgi?id=524223
[132] Same-origin policy — Anne’s Blog ( 版) https://annevankesteren.nl/2015/02/same-origin-policy
[133] Part2 - browsersec - Browser Security Handbook, part 2 - Browser Security Handbook - Google Project Hosting ( 版) https://code.google.com/p/browsersec/wiki/Part2
What’s the origin if you provide content over the broadcast transport though?
The HbbTV specification suggests that in this case the broadcast stream should explicitly define its own web origin by setting the simple_application_boundary_descriptor property in the AIT to any desired domain name.
Yes, you can be anyone you want to be.
[135] HbbTV and Web origins (Mark Nottingham 著, 版) https://lists.w3.org/Archives/Public/www-tag/2015Apr/0052.html
[91] Abusing HTTP status codes to deanonymize web users (Ahmed Elsobky 著, 版) https://lists.w3.org/Archives/Public/public-webappsec/2015May/0043.html
[92] Re: Abusing HTTP status codes to deanonymize web users (Anne van Kesteren 著, 版) https://lists.w3.org/Archives/Public/public-webappsec/2015May/0047.html
[71] Widget Interface ( 版) http://w3c.github.io/packaged-webapps/api/Overview.html#preference-origin-security-check
Behaviors are subject to the About Cross-Frame Scripting and Security rules of Internet Explorer. In other words, a Web page that refers to a behavior located on another server in another domain results in an "access denied" error in the page's onerror event handler. In the same way, a Web page that refers to a behavior of a different security protocol than the referring page will result in the same error. For example, a Web page on http://server1/page.htm might not refer to a behavior on https://server1/hilite.htc.
同一生成元ポリシー (Same Origin Policy) を無効に出来ますか? Midori の設定にない Webkit の設定変更はできませんか?
Midori の設定ファイル (Unix の場合は ~/.config/midori/config、Windows の場合は %APPDATA%\midori\config) で WebKitWebSettings のすべての値を変更できます。例えば、ローカルファイルで同一生成元ポリシーを無効にする場合、以下を追加してください:
enable-universal-access-from-file-uris=true
Not exactly either a limitation, or an extension, but it is worth mentioning here. For security reasons, it is not per default possible for an XForms to submit data to another domain. This is due to security reasons. Information about how to whitelist domain can be found in the Release Notes
The cross domain check also includes forms loaded from file://. Forms loaded from that URL should be local files, and thus trusted, but it is not always the case. So there is not automatic "whitelisting" of local files.
[145] Merge pull request #44 from yoavweiss/timing_allow_same_origin_pass · w3c/resource-timing@960a8cb ( 版) https://github.com/w3c/resource-timing/commit/960a8cbd77d640a5ac981ba9c77208aee6bb84e0
[146] Add some more parameters to the "perform a security check" hook (for … · heycam/webidl@adf3772 ( 版) https://github.com/heycam/webidl/commit/adf37720bd92138f9f1627a214330287550c0004
[147] Merge pull request #65 from andrey-logvinov/gh-pages ( (andrey-logvinov著, )) https://github.com/w3c/wake-lock/commit/7a019503df2a917ca28f3655bcfd953f243703ca
[154] Cross-origin objects: do not wrap JavaScript functions ( (annevk著, )) https://github.com/whatwg/html/commit/db361b608157b5cf9fd0d491d7dc76cdce80380b
[155] Remove unnecessary and unimplemented canvas tainting when painting text (domenic著, ) https://github.com/whatwg/html/commit/6c76b617d2b45326afea2625d174ce2fd5ab6423
問題の脆弱性は、PDFにプログラムを埋め込める「FormCalc」という機能に関連するもの。FormCalcにはネットワーク経由でコンテンツの取得や送信を行える「Get」や「Post」、「Put」といった命令が用意されている。これを利用してPDFが配信されているドメインと同じドメイン上のデータを取得し、それを外部サーバーに送信するという処理をPDFを閲覧するマシン上で自動実行させることができるという。
一般的なWebブラウザでは、スクリプトによるHTTPリクエストについて、リクエスト先をそのスクリプトを配信するドメインに限定する、「同一オリジンポリシー(same-origin policy)」が適用されている(Mozillaによるドキュメント)。しかし、FormCalcではこの制限が緩く、取得した情報を別のサイトに送信できてしまうという。
[157] Reports feature violates the same-origin policy (Anne van Kesteren著, ) https://lists.w3.org/Archives/Public/public-webappsec/2017Feb/0009.html
[158] Re: Reports feature violates the same-origin policy (Mike West著, ) https://lists.w3.org/Archives/Public/public-webappsec/2017Feb/0013.html
[159] Re: Reports feature violates the same-origin policy (Daniel Veditz著, ) https://lists.w3.org/Archives/Public/public-webappsec/2017Feb/0019.html
[160] Re: Reports feature violates the same-origin policy (Anne van Kesteren著, ) https://lists.w3.org/Archives/Public/public-webappsec/2017Feb/0021.html
[161] "Script error." message in window.onerror makes bad DevExp trade off · Issue #2440 · whatwg/html () https://github.com/whatwg/html/issues/2440
[162] Single Trust and Same-Origin Policy v2 (John Wilander著, ) https://lists.w3.org/Archives/Public/public-webappsec/2017Mar/0034.html
[163] Re: Single Trust and Same-Origin Policy v2 (Mike West著, ) https://lists.w3.org/Archives/Public/public-webappsec/2017Mar/0054.html
[164] Make <body topmargin> win over <iframe marginheight> (#2489) (zcorpan著, ) https://github.com/whatwg/html/commit/3fc830124986d8fb0aa53cd2d2f2fea12a926e5d
[166] Enumerate fewer cross-origin properties (annevk著, ) https://github.com/whatwg/html/commit/ad8823782e7f6b7d60f8e216901bb76d1a53dd6d
[167] A primer on cross-origin information leaks (Artur Janc著, ) https://lists.w3.org/Archives/Public/public-webappsec/2018May/0009.html
[168] Exposing CSS subresource URLs · Issue #70 · w3c/resource-timing () https://github.com/w3c/resource-timing/issues/70
[169] Take tainted origin flag into account for the same origin check (annevk著, ) https://github.com/whatwg/fetch/commit/986618a62b2d7d31f93177ed178f0cb21b570d85
[170] Request's tainted origin flag fallout · Issue #756 · whatwg/fetch () https://github.com/whatwg/fetch/issues/756
[171] Take tainted origin flag into account for the same origin check by annevk · Pull Request #834 · whatwg/fetch () https://github.com/whatwg/fetch/pull/834