test(llm): 靶机补记 x-api-key / anthropic-version

Anthropic 协议的鉴权头是 x-api-key,而网关当前只覆写 Authorization。
靶机原来不记录 x-api-key,导致「下游那把 sk_ 是否被原样漏给上游」
在回归里是看不见的 —— 实测已确认会漏。先让靶机把它记下来。
This commit is contained in:
admin committed 2026-09-12 12:15:35 +08:00
1 parent 2ad9ac7815
commit 02601f6d33
1 file changed
+5
+5
View File
@@ -26,6 +26,11 @@ class H(BaseHTTPRequestHandler):
"path": self.path,
"method": self.command,
"auth": self.headers.get("Authorization", "-"),
# x-api-key / anthropic-version 必须记:Anthropic 协议的上游只认
# `x-api-key`,而网关当前只覆写 Authorization。**不记就意味着
# 「下游那把 sk_ 是否被原样漏给上游」这件事在这里是看不见的**。
"x_api_key": self.headers.get("x-api-key", "-"),
"anthropic_version": self.headers.get("anthropic-version", "-"),
"host": self.headers.get("Host", "-"),
"body": body.decode("utf-8", "replace"),
}