| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat(router): whitelist forward of client headers to upstream 之前网关对 upstream 请求完全重写所有 header,client 的 HeaderMap 仅用于本地用途(认证、IP 提取、prompt log 快照、traceparent 提取), 任何 client 自定义 header(User-Agent、X-User-Id、X-Session-Id 等) 都到不了 upstream。这与反向代理的常规期望不符——LLM upstream 有时 需要看到 client 的某些信号(客户端 UA 用于调度、客户端追踪 ID 用于 关联)。litellm 用黑名单剥离(只剥 content-length + host),黑名单无法 应对 client 发明的新 header,且对 cookie / hop-by-hop / IP 信任链 / 可观测性 header 全没剥,是个残缺实现。 新增白名单透传机制: - router_settings.forward_client_headers: Vec<String>(全局配置,非 deployment 级,避开 DB migration 与 DEPLOYMENT_CORE_COLUMNS 同步) 默认空 = default deny,跟历史行为一致 - forward_client_headers() 函数:hard-block x-gateway-* / x-boom-* / authorization / x-api-key / api-key / cookie / set-cookie / surrogate-key,即使 operator 配错也兜底 - compose_gateway_headers() 函数:client 白名单先注入(lowercase key), build_gateway_headers 后注入(也 lowercase)→ 网关值强制覆盖 client 同名值,client 无法伪造 x-gateway-priority 等 - 大小写归一:HTTP header 名大小写不敏感(RFC 7230 §3.2),配置加载与 运行时比对统一 lowercase 同时修复 Anthropic / Azure / Gemini provider 的注入缺口:之前 chat 和 chat_stream 完全不读 req.gateway_headers 字段——OpenAI provider 已经 在用(openai.rs:89-91),这三个 provider 漏了。如果不一起修,白名单 header 进了 req.gateway_headers 但 provider 根本不读这个字段,等于装了开关但 没接线。Bedrock provider 是 stub(TODO: AWS SigV4),跳过。 测试: - boom-config: manifest 两个强制 guard 全过(manifest_covers_all_struct_fields + router_settings_manifest_covers_editable_fields) - boom-main/routes.rs: 7 个单测(空白名单、白名单匹配、大小写归一、 x-gateway-* / x-boom-* 硬阻断、auth/session 名硬阻断、compose 覆盖语义) - boom-provider/anthropic.rs: 3 个 wiremock 测试(chat / chat_stream / 空白名单),pin 住之前不读 req.gateway_headers 的回归点 Signed-off-by: liqiang <liqiang@icecream.local> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: liqiang <liqiang64@huawei.com> | 9 天前 | |
feat(router): whitelist forward of client headers to upstream 之前网关对 upstream 请求完全重写所有 header,client 的 HeaderMap 仅用于本地用途(认证、IP 提取、prompt log 快照、traceparent 提取), 任何 client 自定义 header(User-Agent、X-User-Id、X-Session-Id 等) 都到不了 upstream。这与反向代理的常规期望不符——LLM upstream 有时 需要看到 client 的某些信号(客户端 UA 用于调度、客户端追踪 ID 用于 关联)。litellm 用黑名单剥离(只剥 content-length + host),黑名单无法 应对 client 发明的新 header,且对 cookie / hop-by-hop / IP 信任链 / 可观测性 header 全没剥,是个残缺实现。 新增白名单透传机制: - router_settings.forward_client_headers: Vec<String>(全局配置,非 deployment 级,避开 DB migration 与 DEPLOYMENT_CORE_COLUMNS 同步) 默认空 = default deny,跟历史行为一致 - forward_client_headers() 函数:hard-block x-gateway-* / x-boom-* / authorization / x-api-key / api-key / cookie / set-cookie / surrogate-key,即使 operator 配错也兜底 - compose_gateway_headers() 函数:client 白名单先注入(lowercase key), build_gateway_headers 后注入(也 lowercase)→ 网关值强制覆盖 client 同名值,client 无法伪造 x-gateway-priority 等 - 大小写归一:HTTP header 名大小写不敏感(RFC 7230 §3.2),配置加载与 运行时比对统一 lowercase 同时修复 Anthropic / Azure / Gemini provider 的注入缺口:之前 chat 和 chat_stream 完全不读 req.gateway_headers 字段——OpenAI provider 已经 在用(openai.rs:89-91),这三个 provider 漏了。如果不一起修,白名单 header 进了 req.gateway_headers 但 provider 根本不读这个字段,等于装了开关但 没接线。Bedrock provider 是 stub(TODO: AWS SigV4),跳过。 测试: - boom-config: manifest 两个强制 guard 全过(manifest_covers_all_struct_fields + router_settings_manifest_covers_editable_fields) - boom-main/routes.rs: 7 个单测(空白名单、白名单匹配、大小写归一、 x-gateway-* / x-boom-* 硬阻断、auth/session 名硬阻断、compose 覆盖语义) - boom-provider/anthropic.rs: 3 个 wiremock 测试(chat / chat_stream / 空白名单),pin 住之前不读 req.gateway_headers 的回归点 Signed-off-by: liqiang <liqiang@icecream.local> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: liqiang <liqiang64@huawei.com> | 9 天前 | |
feat(ctxaware): emit X-BooM-Client-Type header for anthropic-routed deployments The gateway normalizes /v1/messages to OpenAI format before forwarding, so upstream vLLM P-nodes can no longer tell whether a request originated as Anthropic-native. This obscures KV-cache reuse opportunities: prompts from /v1/messages vs /v1/chat/completions may want different cache slots. Activate the previously-dormant ClientKind enum and add classify() + wire_label() in boom-ctxaware. The header carries a single-segment label ("anthropic" or "anonymous") to keep the wire format simple for future expansion (claude-code, etc.). Make the header per-deployment opt-in via client_type_header: bool on ModelEntry. The flag rides on the Provider trait alongside deployment_id() and kv_worker_id() so routes.rs can read it after the routing decision and write the header into the existing gateway_headers side-channel — zero provider-layer changes needed. Plumb the flag end-to-end: ModelEntry → Provider structs (5 providers) → DeploymentProviderRow/DeploymentInput/YamlDeploymentData (4 routing structs) → boom_model_deployment DB column → dashboard DTO. Existing patterns (kv_worker_id, max_inflight_queue_len) were followed verbatim. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: liqiang <liqiang64@huawei.com> | 1 个月前 | |
feat(router): whitelist forward of client headers to upstream 之前网关对 upstream 请求完全重写所有 header,client 的 HeaderMap 仅用于本地用途(认证、IP 提取、prompt log 快照、traceparent 提取), 任何 client 自定义 header(User-Agent、X-User-Id、X-Session-Id 等) 都到不了 upstream。这与反向代理的常规期望不符——LLM upstream 有时 需要看到 client 的某些信号(客户端 UA 用于调度、客户端追踪 ID 用于 关联)。litellm 用黑名单剥离(只剥 content-length + host),黑名单无法 应对 client 发明的新 header,且对 cookie / hop-by-hop / IP 信任链 / 可观测性 header 全没剥,是个残缺实现。 新增白名单透传机制: - router_settings.forward_client_headers: Vec<String>(全局配置,非 deployment 级,避开 DB migration 与 DEPLOYMENT_CORE_COLUMNS 同步) 默认空 = default deny,跟历史行为一致 - forward_client_headers() 函数:hard-block x-gateway-* / x-boom-* / authorization / x-api-key / api-key / cookie / set-cookie / surrogate-key,即使 operator 配错也兜底 - compose_gateway_headers() 函数:client 白名单先注入(lowercase key), build_gateway_headers 后注入(也 lowercase)→ 网关值强制覆盖 client 同名值,client 无法伪造 x-gateway-priority 等 - 大小写归一:HTTP header 名大小写不敏感(RFC 7230 §3.2),配置加载与 运行时比对统一 lowercase 同时修复 Anthropic / Azure / Gemini provider 的注入缺口:之前 chat 和 chat_stream 完全不读 req.gateway_headers 字段——OpenAI provider 已经 在用(openai.rs:89-91),这三个 provider 漏了。如果不一起修,白名单 header 进了 req.gateway_headers 但 provider 根本不读这个字段,等于装了开关但 没接线。Bedrock provider 是 stub(TODO: AWS SigV4),跳过。 测试: - boom-config: manifest 两个强制 guard 全过(manifest_covers_all_struct_fields + router_settings_manifest_covers_editable_fields) - boom-main/routes.rs: 7 个单测(空白名单、白名单匹配、大小写归一、 x-gateway-* / x-boom-* 硬阻断、auth/session 名硬阻断、compose 覆盖语义) - boom-provider/anthropic.rs: 3 个 wiremock 测试(chat / chat_stream / 空白名单),pin 住之前不读 req.gateway_headers 的回归点 Signed-off-by: liqiang <liqiang@icecream.local> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: liqiang <liqiang64@huawei.com> | 9 天前 | |
fix(fusion): address PR review findings | 13 天前 | |
fix(fusion): address PR review findings | 13 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 9 天前 | ||
| 9 天前 | ||
| 1 个月前 | ||
| 9 天前 | ||
| 13 天前 | ||
| 13 天前 |