CORS
クロスオリジンリソース共有
CORSはブラウザのHTTP安全ルールです。サーバーはどの他のオリジンが応答を読むことができるかをリストします。メソッド、ヘッダー、資格情報を制限することができます。
もう一つの例
app.example.comのダッシュボードは、api.example.netを呼び出します。APIは、ログインが必要な書き込みの前にpreflightをチェックし、本番環境のoriginだけを許可します。
主な部分
- 01Identity or input
- 02Policy or transformation
- 03Stored result and audit evidence
以下の場合に使用します
ブラウザコードが他のオリジンを読む必要がある場合は、サーバーまたはゲートウェイでCORSを設定します。
以下の場合は使用しないでください
資格情報付きのワイルドカードオリジンを使用したり、未知のオリジンを反映したりしないでください。CORS は認証や CSRF 保護の代わりにはなりません。
コードで使用する名前
Origin / Access-Control-Allow-* / OPTIONS 出荷前に
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:Complete the task with クロスオリジンリソース共有 (CORS)。 User context:app.example.comのダッシュボードは、api.example.netを呼び出します。APIは、ログインが必要な書き込みの前にpreflightをチェックし、本番環境のoriginだけを許可します。 Technical concept or control:クロスオリジンリソース共有 (CORS)。 Why it fits:ブラウザコードが他のオリジンを読む必要がある場合は、サーバーまたはゲートウェイでCORSを設定します。 Do not use it when:資格情報付きのワイルドカードオリジンを使用したり、未知のオリジンを反映したりしないでください。CORS は認証や CSRF 保護の代わりにはなりません。 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):この標準は、列挙された範囲のみを対象とします。視覚スタイル、製品の判断、またはVibularyの例は選びません。 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.
このリクエストを確認する
Review how クロスオリジンリソース共有 (CORS) is used now. Definition: CORSはブラウザのHTTP安全ルールです。サーバーはどの他のオリジンが応答を読むことができるかをリストします。メソッド、ヘッダー、資格情報を制限することができます。 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, list the evidence, gaps, severity, and the smallest safe fix.