shaw
c5147eab16
fix(accounts): 身份上报变量审计修复
...
- request_id 可由客户端经 X-Request-ID 自带:代入前只保留字母数字与
. _ -,其余替换为下划线并限长,防止在组合模板里伪造其它身份字段
- 模板不合法的存量条目不再被提前丢弃:应用时删除同名客户端头且不发送
- 错误记录中的上报请求头不再包含固定文本(可能是中转密钥),混合模板
记为 "…name=value" 形态
- 模型列表/清单等跨用户共享缓存的请求不携带用户身份,避免缓存被打散
- 只改账号类型(不带 credentials)的更新同样校验变量使用
- 编辑器连点同一变量不再产生重名行
- 补充认证中间件到真实转发构建器的端到端用例
2026-11-24 10:56:25 +08:00
shaw
0f1e3c1f6a
feat(accounts): 请求头覆写支持身份上报变量
...
API Key 账号的请求头覆写值可使用 {{user_id}} / {{api_key_id}} /
{{group_id}} / {{request_id}},转发时替换为本次请求的网关身份,便于
逐层定位到具体用户。
- 仅 api_key 账号解析变量;OAuth(含 Grok OAuth)保存时拒绝,运行时
整条请求头不发送
- 变量取不到值(无用户上下文的后台请求)时整条不发送,同名的客户端
请求头照样删除,防止伪造
- OpenAI WS 连接池按上报身份分桶,握手头不解析 request_id
- 错误记录的上游事件记录实际上报的请求头(仅变量生成的部分),错误
详情新增「身份上报请求头」区块
- 编辑器新增变量面板、发送示例预览与行内错误提示
2026-11-24 10:28:55 +08:00
Wesley Liddick
00c51f07d2
Merge pull request #9045 from itzhan/fix/openai-passthrough-400-error-forwarding
...
fix(openai): preserve invalid_encrypted_content and apply error passthrough rules in passthrough mode
2026-11-24 09:58:02 +08:00
shaw
eabf37852a
fix(openai): compact response.failed 改写容量降载码,空白 code 回退内嵌提取
...
- 透传结构化错误在 compact 心跳已提交时写 response.failed,上游的
server_is_overloaded / slow_down 必须与其它写 response.failed 的路径一样
改写为可重试的 server_error,否则 Codex 会直接终止会话
- error.code 为空白字符串时回退到 message 内嵌 JSON 的 code,与错误分类
看到的 code 保持一致
- 移除测试文件中仅为保留 import 而存在的占位变量
2026-11-24 09:42:41 +08:00
shaw
34423bf1e1
fix(accounts): 上游分组文字先修剪再校验控制字符
...
首尾的换行或制表符只是多余空白,不应导致整个字段被丢弃而不同步;
修剪后仍含控制字符的才拒绝。
2026-11-24 09:42:39 +08:00
shaw
797fde4e95
fix(deps): 升级 gorilla/websocket 修复 GO-2026-6278
...
govulncheck 新收录 GO-2026-6278(WebSocket mask key 使用弱随机数),
v1.5.3 受影响且上游尚无带修复的正式 tag,升级到 govulncheck 指定的修复
提交 v1.5.4-0.20240701034025-d67f41855da4。
该库仅用于管理端 ops WebSocket 的服务端升级;服务端只声明 sub2api-admin
一个子协议,上游对子协议匹配顺序的调整不改变协商结果。
2026-11-24 09:21:39 +08:00
shaw
ba9df6f1c3
fix(deps): 升级 gorilla/websocket 修复 GO-2026-6278
...
govulncheck 新收录 GO-2026-6278(WebSocket mask key 使用弱随机数),
v1.5.3 受影响且上游尚无带修复的正式 tag,升级到 govulncheck 指定的修复
提交 v1.5.4-0.20240701034025-d67f41855da4。
该库仅用于管理端 ops WebSocket 的服务端升级;服务端只声明 sub2api-admin
一个子协议,上游对子协议匹配顺序的调整不改变协商结果。
2026-11-24 09:21:38 +08:00
shaw
38903b6d1d
fix(accounts): 上游分组文字入库前校验,include 支持多值
...
- 上游分组名称/描述与探测快照、倍率在同一条 UPDATE 中写库。gjson 对未转义
字符串返回原始字节,非法 UTF-8 会被 PostgreSQL 以 22021 拒绝,导致整条
UPDATE 失败:快照与倍率都写不进去,next_probe_at 不推进,账号每个调度
周期都被重试并挤占探测名额。现在非法 UTF-8 只丢弃对应字段
- 名称拒绝控制字符,备注仅保留换行与制表符,避免上游向管理端写入
转义序列等不可见内容
- /v1/sub2api/billing 的 include 按逗号分隔列表解析并支持重复参数,
后续新增可选段时不会让 include=group 失效
2026-11-24 08:58:55 +08:00
shaw
4339d50615
fix(openai): 修复透传错误脱敏越界并收紧结构化错误字段
...
- replaceCaseInsensitive 改为在原始字节上做大小写不敏感匹配。原实现用
strings.ToLower 后的下标切原串,遇到折叠后字节长度变化的字符(Ⱥ、Kelvin
符号、非法 UTF-8)会越界 panic 或把上游主机名原样漏给客户端;同时消除
该函数的 errcheck 告警
- error.type/code/param 只接受字符串或数字并限长 256 字节,避免上游把对象
或数组以原始 JSON 形式塞进这三个字段
- 规则命中且未配置自定义文案时,上游消息同样经过凭据与主机名脱敏
- compact 心跳已提交时 response.failed 保留结构化 error.code
2026-11-24 08:56:01 +08:00
itzhan
2b74378321
fix(openai): preserve invalid_encrypted_content and apply error passthrough rules in passthrough mode
2026-11-23 20:16:47 +08:00
Brisbanehuang
03aa05fd9f
feat(accounts): 按账号自动同步上游分组名称与备注
2026-11-21 07:02:53 -08:00
Brisbanehuang
a95c9e2631
feat(accounts): 支持从上游分组同步账号名称与备注
2026-11-21 06:03:52 -08:00
github-actions[bot]
328db26f45
chore: sync VERSION to 0.2.24 [skip ci]
2026-11-20 09:20:06 +00:00
Wesley Liddick
5c2982a81b
Merge commit from fork
...
fix(gateway): reject request bodies whose duplicate fields disagree
2026-11-20 16:57:02 +08:00
Wesley Liddick
62cebadf54
Merge pull request #8886 from SipengXie2024/fix/images-sse-usage-single-line
...
fix(openai): keep relayed image usage on a single SSE data line
2026-11-20 15:59:27 +08:00
Wesley Liddick
eb9143956f
Merge pull request #8979 from SipengXie2024/fix/antigravity-quota-forward-endpoint
...
fix(antigravity): query quota from the account's forward endpoint
2026-11-20 15:54:52 +08:00
Wesley Liddick
242556f973
Merge pull request #8973 from william-drakemond/pr/antigravity-bare429-request-scoped
...
fix(antigravity): 一个请求的裸 429 最多冷却一个账号 / A bare 429 cools at most one account per request
2026-11-20 15:54:45 +08:00
Wesley Liddick
cdf3af4b84
Merge pull request #8972 from r266-tech/codex/typesafe-apply-account-model-mapping
...
fix(typesafe): apply account model mapping to System One
2026-11-20 15:54:41 +08:00
Wesley Liddick
58659ec579
Merge pull request #8968 from wucm667/fix/issue-8967-image-timeout-failover
...
fix(openai): fail over upstream request timeouts
2026-11-20 15:54:38 +08:00
Wesley Liddick
ba5ddded9c
Merge pull request #8963 from Daiyangcheng/fix/responses-stop-passthrough
...
fix(gateway): preserve stop sequences and Kimi tool definitions across protocol conversions
2026-11-20 15:54:34 +08:00
Wesley Liddick
c03fc529b8
Merge pull request #8962 from wucm667/fix/issue-8957-grok-edit-input
...
fix(grok): accept five edit sources and preserve validation errors
2026-11-20 15:54:31 +08:00
Wesley Liddick
55898028ad
Merge pull request #8946 from r266-tech/codex/gemini-upstream-comment-frames
...
fix(antigravity): preserve upstream Gemini SSE comment frames
2026-11-20 15:54:28 +08:00
Wesley Liddick
50dc3141e7
Merge pull request #8943 from alfadb/fix/deepseek-thinking-passback
...
fix(gateway): 补齐 DeepSeek Anthropic 工具续接历史缺失的 thinking 块
2026-11-20 15:54:24 +08:00
Wesley Liddick
1134f5dffb
Merge pull request #8937 from TeacherLi07/fix/ops-duration-weighted-token-rate
...
fix(ops): 按累计请求耗时计算模型平均 Tokens/秒
2026-11-20 15:54:21 +08:00
Wesley Liddick
320695ae72
Merge pull request #8932 from superman2003/fix/codex-catalog-audio-input
...
fix(codex): preserve native audio input capabilities
2026-11-20 15:54:17 +08:00
Wesley Liddick
fe1f2b6d76
Merge pull request #8931 from superman2003/fix/responses-requested-effort
...
fix(usage): record per-turn Responses reasoning effort
2026-11-20 15:54:14 +08:00
Wesley Liddick
a641897402
Merge pull request #8929 from superman2003/fix/codex-standalone-context-names
...
fix(openai): preserve VS Code IDE context in HTTP Responses
2026-11-20 15:54:10 +08:00
Wesley Liddick
16b67d9afd
Merge pull request #8923 from iam1maker/fix/gemini-final-turn-trailing-parts
...
fix(gemini): keep trailing parts out of the final tool-result turn
2026-11-20 15:54:07 +08:00
Wesley Liddick
a912d13e62
Merge pull request #8918 from XYZ0901/codex/fix-admin-user-default-platform-quotas
...
fix(admin): 后台创建用户初始化默认平台限额
2026-11-20 15:54:02 +08:00
Wesley Liddick
69237d2ebd
Merge pull request #8911 from Echways/fix/anthropic-account-test-temperature
...
fix(accounts): omit temperature from account tests for models that reject it
2026-11-20 15:53:58 +08:00
Wesley Liddick
88ff563f73
Merge pull request #8900 from stevelee477/feat/claude-window-cost-estimate
...
feat(accounts): estimate Claude OAuth and setup-token window costs
2026-11-20 15:53:52 +08:00
Wesley Liddick
fe2d953f52
Merge pull request #8893 from SipengXie2024/fix/openai-oauth-skip-claude-models
...
fix(openai): skip foreign-vendor models on ChatGPT OAuth accounts, passthrough included
2026-11-20 15:53:45 +08:00
Wesley Liddick
490af330d7
Merge pull request #8883 from wucm667/fix/issue-8880-anthropic-model-metadata
...
fix(anthropic): expose metadata-backed long-context models
2026-11-20 15:53:42 +08:00
Wesley Liddick
fb7d8fc7b9
Merge pull request #8875 from zhx8702/fix/openai-body-copy-reduction
...
fix(openai): stop pinning large request bodies after the handler
2026-11-20 15:53:38 +08:00
Wesley Liddick
356cdccbe8
Merge pull request #8872 from lishuangqiang/perf/tool-schema-sanitizer
...
perf(openai): stop walking every request body in the tool-schema sanitizer
2026-11-20 15:53:35 +08:00
Wesley Liddick
67b2df8d91
Merge pull request #8870 from lishuangqiang/perf/openai-namespace-strip-copies
...
perf(openai): stop copying the whole input array when stripping namespaces
2026-11-20 15:53:32 +08:00
Wesley Liddick
a437224cd2
Merge pull request #8868 from lishuangqiang/perf/gateway-request-single-scan
...
perf(gateway): parse the request body once instead of eight times
2026-11-20 15:53:28 +08:00
Wesley Liddick
50c802c518
Merge pull request #8866 from lishuangqiang/perf/image-intent-prefilter
...
perf(openai): stop re-validating the same body when classifying image intent
2026-11-20 15:53:24 +08:00
Wesley Liddick
9cf9921eb4
Merge pull request #8864 from Anankke/fix/grok-search-billing-usage
...
fix(grok): bill search calls from xAI usage success counts
2026-11-20 15:53:21 +08:00
Wesley Liddick
998d1c8e2e
Merge pull request #8862 from lishuangqiang/perf/cache-control-ttl-short-circuit
...
perf(gateway): skip the cache_control TTL walk when no 1h breakpoint exists
2026-11-20 15:53:17 +08:00
Wesley Liddick
3ad84e1333
Merge pull request #8859 from Anankke/fix/composite-route-thinking-adapt
...
fix(composite): adapt thinking to the Claude 5.5 model a route rewrites to
2026-11-20 15:53:14 +08:00
Wesley Liddick
84a293056a
Merge pull request #8845 from r266-tech/codex/scheduler-compact-account-groups
...
perf(scheduler): omit expanded groups from account cache
2026-11-20 15:53:07 +08:00
Wesley Liddick
600e1e1888
Merge pull request #8820 from Anankke/fix/buffered-hosted-output-items
...
fix(openai): rebuild empty buffered output from done items
2026-11-20 15:53:03 +08:00
Wesley Liddick
135aff88e1
Merge pull request #8804 from Anankke/fix/messages-bridge-native-tool-search
...
fix(apicompat): map ToolSearch to native tool_search for Codex OAuth
2026-11-20 15:52:59 +08:00
Wesley Liddick
d36670a041
Merge pull request #8803 from Anankke/feat/web-search-sources-bridge
...
feat(apicompat): return web_search sources in web_search_tool_result blocks
2026-11-20 15:52:56 +08:00
Wesley Liddick
fb60f04173
Merge pull request #8801 from Anankke/feat/websearch-exa-provider
...
feat(websearch): add Exa as a web search emulation provider
2026-11-20 15:52:53 +08:00
Wesley Liddick
3027001928
Merge pull request #8794 from Anankke/feat/compaction-cache-ttl-5m
...
feat(gateway): write Claude Code compaction requests at 5m cache TTL
2026-11-20 15:52:50 +08:00
Wesley Liddick
c38a534be9
Merge pull request #8671 from xuemk/fix/openai-oauth-token-rotation-persistence
...
fix(openai): protect rotated oauth credentials from enrichment timeout and race conditions
2026-11-20 15:52:46 +08:00
shaw
fe5e7fa404
fix(openai): stop alpha/search tool-level 403s from benching OAuth accounts
...
A Codex literature search (gpt-6.2-astra with literature_search_query)
on a plan without that capability gets 403
{"detail":"Literature search is unavailable."} from /alpha/search. The
alpha/search side-effect gate only exempted 401/404/405, so the 403 went
through the generic OpenAI 403 path: the first hit cools the account for
10 minutes and three hits within 3 hours mark it errored until an admin
clears it. 403 is also a failover status, so one request replays across
the pool. In production, one request paused all 9 OAuth accounts within
4 seconds.
On alpha/search (and the PAT Responses fallback), a 403 now writes account
state only when it is an account or workspace access-state error
(deactivated, disabled, ...). Every other 403 is the search tool refusing
the request: the request still fails over, since another account's plan
may allow it, but no account is cooled, counted or errored.
2026-11-20 14:22:44 +08:00
shaw
a436766de3
fix(gateway): satisfy errcheck in duplicate-field scanner
...
Build the conflict path by appending to a byte slice instead of ignoring
strings.Builder write results, and discard builder results explicitly in
tests. golangci-lint v2.14.0 (CI version) reports 0 issues.
Refs: GHSA-p3r4-jcm3-2hph
2026-11-20 13:55:58 +08:00