我今天在探索 ChatGPT 代理的工作原理。我了解到一些关于它如何通过 HTTP 标头暴露身份的有趣信息,然后犯了一个大错误,以为它会将 URL 泄露给 Bingbot 和 Yandex……但后来发现,这是 Cloudflare 的一个功能,与 ChatGPT 无关。
ChatGPT 代理是最近发布的(名称容易混淆)ChatGPT 功能,它作为 ChatGPT 的一项功能提供浏览器自动化与终端访问相结合 – 取代其之前的Operator 研究预览版,该预览版计划于 8 月 31 日弃用。
调查 ChatGPT 代理的用户代理
我决定通过使用django-http-debug创建一个记录的 Web URL 端点来深入研究它的工作原理。然后我告诉 ChatGPT 代理模式探索这个新页面:
我的日志捕获了这些请求标头:
Via: 1.1 heroku-router Host: simonwillison.net Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Cf-Ray: 96a0f289adcb8e8e-SEA Cookie: cf_clearance=zzV8W... Server: Heroku Cdn-Loop: cloudflare; loops=1 Priority: u=0, i Sec-Ch-Ua: "Not)A;Brand";v="8", "Chromium";v="138" Signature: sig1=:1AxfqHocTf693inKKMQ7NRoHoWAZ9d/vY4D/FO0+MqdFBy0HEH3ZIRv1c3hyiTrzCvquqDC8eYl1ojcPYOSpCQ==: Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Cf-Ipcountry: US X-Request-Id: 45ef5be4-ead3-99d5-f018-13c4a55864d3 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: none Sec-Fetch-User: ?1 Accept-Encoding: gzip, br Accept-Language: en-US,en;q=0.9 Signature-Agent: "https://chatgpt.com" Signature-Input: sig1=("@authority" "@method" "@path" "signature-agent");created=1754340838;keyid="otMqcjr17mGyruktGvJU8oojQTSMHlVm7uO-lrcqbdg";expires=1754344438;nonce="_8jbGwfLcgt_vUeiZQdWvfyIeh9FmlthEXElL-O2Rq5zydBYWivw4R3sV9PV-zGwZ2OEGr3T2Pmeo2NzmboMeQ";tag="web-bot-auth";alg="ed25519" X-Forwarded-For: 2a09:bac5:665f:1541::21e:154, 172.71.147.183 X-Request-Start: 1754340840059 Cf-Connecting-Ip: 2a09:bac5:665f:1541::21e:154 Sec-Ch-Ua-Mobile: ?0 X-Forwarded-Port: 80 X-Forwarded-Proto: http Sec-Ch-Ua-Platform: "Linux" Upgrade-Insecure-Requests: 1
那Via: 1.1 heroku-router Host: simonwillison.net Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Cf-Ray: 96a0f289adcb8e8e-SEA Cookie: cf_clearance=zzV8W... Server: Heroku Cdn-Loop: cloudflare; loops=1 Priority: u=0, i Sec-Ch-Ua: "Not)A;Brand";v="8", "Chromium";v="138" Signature: sig1=:1AxfqHocTf693inKKMQ7NRoHoWAZ9d/vY4D/FO0+MqdFBy0HEH3ZIRv1c3hyiTrzCvquqDC8eYl1ojcPYOSpCQ==: Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Cf-Ipcountry: US X-Request-Id: 45ef5be4-ead3-99d5-f018-13c4a55864d3 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: none Sec-Fetch-User: ?1 Accept-Encoding: gzip, br Accept-Language: en-US,en;q=0.9 Signature-Agent: "https://chatgpt.com" Signature-Input: sig1=("@authority" "@method" "@path" "signature-agent");created=1754340838;keyid="otMqcjr17mGyruktGvJU8oojQTSMHlVm7uO-lrcqbdg";expires=1754344438;nonce="_8jbGwfLcgt_vUeiZQdWvfyIeh9FmlthEXElL-O2Rq5zydBYWivw4R3sV9PV-zGwZ2OEGr3T2Pmeo2NzmboMeQ";tag="web-bot-auth";alg="ed25519" X-Forwarded-For: 2a09:bac5:665f:1541::21e:154, 172.71.147.183 X-Request-Start: 1754340840059 Cf-Connecting-Ip: 2a09:bac5:665f:1541::21e:154 Sec-Ch-Ua-Mobile: ?0 X-Forwarded-Port: 80 X-Forwarded-Proto: http Sec-Ch-Ua-Platform: "Linux" Upgrade-Insecure-Requests: 1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML,如 Gecko) Chrome/138.0.0.0 Safari/537.36用户代理标头是 macOS 上最新的 Chrome 使用的标头 – 这有点奇怪,因为Sec-Ch-Ua-Platform:“Linux”表示代理浏览器在 Linux 上运行。
乍一看,ChatGPT 似乎有些不诚实,因为它没有在 User-Agent 标头中包含其机器人身份。我一度以为它可能是我自己的 User-Agent,但我在 macOS 上使用 Firefox,它却将自己标识为 Chrome。
然后我发现了这个标题:
它附带一个更复杂的标题,称为Signature-Agent: "https://chatgpt.com"
签名输入:
和一个Signature-Input: sig1=("@authority" "@method" "@path" "signature-agent");created=1754340838;keyid="otMqcjr17mGyruktGvJU8oojQTSMHlVm7uO-lrcqbdg";expires=1754344438;nonce="_8jbGwfLcgt_vUeiZQdWvfyIeh9FmlthEXElL-O2Rq5zydBYWivw4R3sV9PV-zGwZ2OEGr3T2Pmeo2NzmboMeQ";tag="web-bot-auth";alg="ed25519"
Signature
头也是。
事实证明,这些来自一个相对较新的网络标准:2024 年 2 月发布的RFC 9421 HTTP 消息签名。
HTTP 消息签名的目的是允许客户端以无法被中间人篡改的方式包含有关其请求的签名数据。签名使用由以下知名端点提供的公钥:
把所有这些加在一起,我们现在有一个可靠的方法来识别来自 ChatGPT 代理的流量:寻找https://chatgpt.com/.well-known/http-message-signatures-directory
Signature-Agent: "https://chatgpt.com"
标头,并通过检查Signature-Input
和Signature
标头中的签名来确认其值。
然后是 Bingbot 和 Yandex
捕获该请求后仅一分钟,我的日志记录端点就收到了另一个请求:
Via: 1.1 heroku-router From: bingbot(at)microsoft.com Host: simonwillison.net Accept: */* Cf-Ray: 96a0f4671d1fc3c6-SEA Server: Heroku Cdn-Loop: cloudflare; loops=1 Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36 Cf-Ipcountry: US X-Request-Id: 6214f5dc-a4ea-5390-1beb-f2d26eac5d01 Accept-Encoding: gzip, br X-Forwarded-For: 207.46.13.9, 172.71.150.252 X-Request-Start: 1754340916429 Cf-Connecting-Ip: 207.46.13.9 X-Forwarded-Port: 80 X-Forwarded-Proto: http
我粘贴了Via: 1.1 heroku-router From: bingbot(at)microsoft.com Host: simonwillison.net Accept: */* Cf-Ray: 96a0f4671d1fc3c6-SEA Server: Heroku Cdn-Loop: cloudflare; loops=1 Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/116.0.1938.76 Safari/537.36 Cf-Ipcountry: US X-Request-Id: 6214f5dc-a4ea-5390-1beb-f2d26eac5d01 Accept-Encoding: gzip, br X-Forwarded-For: 207.46.13.9, 172.71.150.252 X-Request-Start: 1754340916429 Cf-Connecting-Ip: 207.46.13.9 X-Forwarded-Port: 80 X-Forwarded-Proto: http
207.46.13.9
进入微软的Verify Bingbot工具(在解决了一个特别费力的 CAPTCHA 之后),它确认这确实是来自 Bingbot 的请求。
我设置了第二个 URL 来确认…这次得到了来自 Yandex 的访问!
Via: 1.1 heroku-router From: [email protected] Host: simonwillison.net Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Cf-Ray: 96a16390d8f6f3a7-DME Server: Heroku Cdn-Loop: cloudflare; loops=1 Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots) Cf-Ipcountry: RU X-Request-Id: 3cdcbdba-f629-0d29-b453-61644da43c6c Accept-Encoding: gzip, br X-Forwarded-For: 213.180.203.138, 172.71.184.65 X-Request-Start: 1754345469921 Cf-Connecting-Ip: 213.180.203.138 X-Forwarded-Port: 80 X-Forwarded-Proto: http
雅尼克斯Via: 1.1 heroku-router From: [email protected] Host: simonwillison.net Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Cf-Ray: 96a16390d8f6f3a7-DME Server: Heroku Cdn-Loop: cloudflare; loops=1 Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots) Cf-Ipcountry: RU X-Request-Id: 3cdcbdba-f629-0d29-b453-61644da43c6c Accept-Encoding: gzip, br X-Forwarded-For: 213.180.203.138, 172.71.184.65 X-Request-Start: 1754345469921 Cf-Connecting-Ip: 213.180.203.138 X-Forwarded-Port: 80 X-Forwarded-Proto: http
建议进行反向 DNS 查找来验证,因此我运行了以下命令:
并得到以下结果: dig -x 213.180.203.138 +short
这证实了这确实是一个 Yandex 爬虫。 213-180-203-138.spider.yandex.com.
为了确保万无一失,我尝试了第三次实验……并且得到了 Bingbot 和 YandexBot 的点击。
这是 Cloudflare Crawler Hints,而不是 ChatGPT
于是我写下并发布了我的发现…… Jatan Loya 问道:
你在 cf 中启用了爬虫提示吗?
是的,事实证明我确实这么做了。我在我的缓存配置页面中发现了这一点(看起来我之前肯定是自己打开了它):
我删除了我在 Twitter 和 Bluesky 上的帖子(因为你不能编辑这些帖子,而且我不想让错误信息继续传播),并编辑了我在 Mastodon 上的帖子,然后用发生这种情况的真正原因更新了此条目。
我还更改了此条目的 URL,因为事实证明 Twitter 和 Bluesky 正在缓存我上一个社交媒体预览,其中包含标题中不正确的信息。
原文“这里发生了什么?”部分来自我的帖子
这是我原始帖子的一部分,其中包含了我在了解 Cloudflare Crawler Hints 之前发生的事情的理论。
那么这里发生了什么?
这里有很多不同的活动部件。
- 我在 macOS 上使用 Firefox,并安装并启用了 1Password 和 Readwise Highlighter 扩展程序。由于我根本没有用自己的浏览器访问调试页面,所以我认为这些与结果无关。
- ChatGPT 代理仅向我的调试 URL 发出一个请求……
- …通过 Cloudflare 和 Heroku 代理。
- 大约一分钟内,我收到了来自 Bingbot 和 Yandex 中的一个或两个的点击。
据推测,ChatGPT 代理本身至少在一个代理后面运行——我希望 OpenAI 密切关注该流量以确保它不会被滥用。
我猜测该基础设施由 Microsoft Azure 托管。OpenAI子处理器列表– 尽管在“云基础设施”部分列出了 Microsoft Corporation、CoreWeave Inc、Oracle Cloud Platform 和 Google Cloud Platform,因此可能是其中任何一个。
由于该页面是通过 HTTPS 提供的,我猜测任何中间代理都应该无法看到 URL 的路径部分,这使得 Bingbot 和 Yandex 如何看到该 URL 的谜团更加令人着迷。
标签: bing 、隐私、搜索引擎、用户代理、人工智能、 cloudflare 、 generative-ai 、 chatgpt 、 llms
原文: https://simonwillison.net/2025/Aug/4/chatgpt-agents-user-agent/#atom-everything