server: trailing metadata is echoed unfiltered, and the reserved-name policy needs deciding
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- grpc, rust
調査の方向性
まず ConnectError::with_trailers、build_grpc_trailers、add_trailers を通る trailer フローを読み、次に #262 で取り消された試みを確認します。動作を変更する前に、予約名、出所、可観測性、エスケープハッチのポリシーを解決してください。trailer に特化したテストを追加し、結果を検証するために #262 の grpc-go/connect-go 相互運用ハーネスのパターンを使用します。
索引モデルが issue の本文から書いたものです。
説明
Summary
#262 stops the server echoing an upstream error's response headers onto the wire, because an echoed content-length made hyper write zero bytes and drop a Connect/HTTP-1.1 connection. The same class exists one frame later, in trailers, and it is not fixed there: err.trailers() and the handler's context trailing metadata are both echoed with no filtering at all.
Measured against real clients — a gateway propagating an upstream failure puts content-length: 4096, connection: keep-alive, transfer-encoding: chunked and a second content-type into the HTTP/2 trailers frame, and they arrive verbatim at both grpc-go v1.81.1 and connect-go v1.19.1. On the Connect unary path the same names arrive as trailer--prefixed headers. Both Go clients tolerate it today, so this is latent rather than breaking, unlike the header case.
An attempt to fix it inside #262 was reverted, because it turned out to need a policy decision rather than a predicate. The attempt is worth reading before redoing it — what follows is what it ran into.
Why this is not just "call the same predicate on trailers"
Provenance is not derivable where the filtering happens. ConnectError::with_trailers is a plain public handler API — "Add response trailers to be included in the error response" — and this repo's own conformance server calls it at six sites. So err.trailers() may hold trailing metadata a handler authored deliberately, or metadata propagated from an upstream, and nothing at the call site distinguishes them. A flag threaded from the call sites tracks which struct field the trailers arrived in, not who wrote them; the attempt did exactly that and the flag was wrong for every error path.
That matters because the two cases want different handling. Silently dropping an upstream's content-length is right. Silently dropping a name a handler deliberately set is a bad afternoon for that handler, with no signal.
But the obvious signal is remotely drivable. Logging a warning when a reserved name is dropped from handler-set metadata sounds right until you notice that handler-set trailer names are frequently derived from request data — the conformance server sets resp.trailers verbatim from the request payload, and real gateways that echo caller-supplied metadata have the same shape. That is one log line per RPC at whatever rate a peer can sustain, unbounded and undeduplicated.
And the source-selection branch has the same bug one level up. build_grpc_trailers decides between the error's trailers and the context's by testing whether the error's are non-empty. Filter after that test and an upstream error whose trailers are entirely reserved names suppresses the handler's own context trailers and emits nothing at all.
What a fix has to decide
- Which names. The header-side list in #262 is hop-by-hop, body framing, provenance (
date), and status-bearing (grpc-status,grpc-message,grpc-status-details-bin). Not all of it transfers: inadd_trailersevery name is rewritten totrailer-{name}before it reaches the wire, so a forwardedcontent-lengthbecomestrailer-content-length, which cannot reach hyper's length encoder or be mistaken for framing by any client. Filtering there is cross-hop consistency, not a fix — worth deciding whether that is a reason to do it or a reason not to. - Whose metadata. Forwarded only, or handler-set too? Forwarded-only is defensible and much smaller. Handler-set filtering is a behaviour change on the success path, which no bug in #202 or #262 reached.
- Observable how. If handler-set names are stripped, a handler needs to find out without giving a peer a log-amplification lever. A
debug!, a once-per-process warning per name, or a compile-time/API-level rejection at the setter are all candidates. The setter is the one place provenance is unambiguous. - What the escape hatch is. If a handler genuinely wants
dateas trailing metadata, is the answer "you cannot", or a namespaced form, or an explicit opt-out?
Notes
server, via and alt-svc were considered and deliberately left forwarded. The argument for leaving them: the deny-list is a correctness boundary where every entry has a mechanical failure attached, and suppressing a few well-known identity headers while forwarding arbitrary upstream metadata does not make a gateway non-leaky — it makes it look non-leaky. A gateway that must not disclose upstream identity should strip metadata wholesale in an interceptor. alt-svc is the one worth revisiting, since a forwarded one redirects the client's future connections.
Conformance says nothing about any of this: the only trailer names anywhere in the upstream testsuite are x-custom-trailer and x-custom-header, so the whole reserved-name question is unexercised. A fix needs its own tests, and the interop harness pattern from #262 (real grpc-go and connect-go clients against our server, with a per-header bisect) is the way to check it.
- 主要言語
- Rust
- スター
- 542
- フォーク
- 74
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
connectrpc/connect-rust のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
connectrpc/connect-rust#358 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 53/100
connectrpc/connect-rust#355 ·
-
Streaming request body errors are always reported as `internal`対応中かも @AhmedElBanna80 が 13 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
connectrpc/connect-rust#352 ·
-
難易度 3/5 半日 初心者へのやさしさ 48/100
connectrpc/connect-rust#349 ·
-
Client fails 12 cases of connectconformance v1.0.7 (gRPC-Web bidi metadata, gRPC truncated server-stream message)対応中かも @excavador が 29 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
connectrpc/connect-rust#346 · コメント 1 件 ·
connectrpc/connect-rust の issue をすべて見る
似ている issue
-
nightly-cleanup
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
max-sixty/worktrunk#4939 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursオープンflaky
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
stacks-network/stacks-core#7918 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
New Mutants Foundオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rust-bitcoin/rust-bech32#339 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
databendlabs/openraft#2554 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
autofixer: follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tursodatabase/turso#12683 ·
メンテナーはふだん 1 日以内に返信