Add a typed, explicit CORS policy evaluator
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
必要な契約とリンク先の WHATWG Fetch Standard の CORS セクションから始め、次にリポジトリの Roc request/response 型と real-listener のテストセットアップを見つけます。実装前に policy と result の境界を定義します。real-listener テストで、実際のケースと preflight ケース、正規化、wildcard/credential、Vary、デフォルト無効、キャッシュされたバリアントがカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Add a pure Cors module that evaluates actual and preflight requests against an immutable policy.
Illustrative flow:
match Cors.evaluate(policy, request) {
NotCors => handle(request)
Preflight(response) => Ok(Server.respond(response))
Rejected(response) => Ok(Server.respond(response))
Allowed(cors_headers) => {
response = handle(request)?
Ok(Server.respond(Cors.apply(cors_headers, response)?))
}
}
Why this belongs in the platform
CORS is widely supplied by web-framework middleware, including tower-http. Its header interactions are sufficiently subtle that applications should not independently reproduce them.
It should remain an explicit Roc request/response transformation. It does not require a new middleware runtime or host callback.
Required contract
- CORS is disabled unless an application constructs and invokes a policy.
- Exact serialized origins—scheme, host, and port—are the initial allowlist mechanism.
- Treat the special
nullorigin as denied unless explicitly allowed. - Validate requested methods and header names for preflight requests.
- Support configured exposed headers, credential permission, and bounded preflight max age.
- Reject policy construction that combines credentialed requests with wildcard origin.
- Dynamic origin responses merge
Vary: Origincase-insensitively without discarding existingVaryvalues. Access-Control-Allow-Credentialsmust serialize as lowercasetrue.- Preflight responses do not depend on receiving credentials; browsers do not attach credentials to the preflight itself.
- Malformed or conflicting
Originfields produce a deterministic denial. - The result distinguishes non-CORS, allowed actual, successful preflight, and rejected requests.
Documentation must emphasize that CORS is not CSRF protection. A "simple" cross-origin request can still perform a server-side action even when the browser refuses to expose its response.
Non-goals
- Regex or suffix origin matching in the first version
- Guessing trusted origins from
Hostor forwarded headers - CSRF protection
- Authentication or authorization
- Applying CORS automatically to native file or operational routes
- A generic middleware stack
Acceptance criteria
- Actual and preflight requests are handled from the same validated policy.
- Wildcard/credentials and
Varybehavior follow the Fetch Standard. - Origin, method, and header matching have explicit case and normalization rules.
- No CORS behavior is enabled by default.
- Real-listener tests cover allowed, denied, credentialed, and cached variants.
References
- 主要言語
- HTML
- スター
- 110
- フォーク
- 25
- 平均マージ
- 18時間 28分
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
roc-lang/basic-webserver のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
roc-lang/basic-webserver#277 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
roc-lang/basic-webserver#274 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
roc-lang/basic-webserver#273 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
roc-lang/basic-webserver#272 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
roc-lang/basic-webserver#265 ·
メンテナーはふだん 1 日以内に返信
roc-lang/basic-webserver の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
OHDSI/Data2Evidence#3815 ·
メンテナーはふだん 3 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
redhat-developer/rhdh-plugin-export-overlays#4995 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fidelity
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hosts対応中かも @huanghaoyuanhhy が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zilliztech/milvus-backup#1418 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] download repeatedly fetches unchanged gzip responses due to compressed/decoded size mismatch対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
stanfordnlp/dspy#11000 ·
メンテナーはふだん 1 日以内に返信