fix(codex): hash app-server env values in client keys · openclaw/openclaw@a1c88f3
pashpashpash
·
2026-04-28
·
via Recent Commits to openclaw:main
File tree
extensions/codex/src/app-server
| Original file line number | Diff line number | Diff line change |
|---|
@@ -302,6 +302,27 @@ describe("Codex app-server config", () => {
|
302 | 302 | expect(second).not.toContain("tok_second"); |
303 | 303 | }); |
304 | 304 | |
| 305 | +it("derives distinct shared-client keys for distinct env values without exposing them", () => { |
| 306 | +const first = codexAppServerStartOptionsKey({ |
| 307 | +transport: "stdio", |
| 308 | +command: "codex", |
| 309 | +args: ["app-server"], |
| 310 | +headers: {}, |
| 311 | +env: { OPENAI_API_KEY: "sk-first" }, |
| 312 | +}); |
| 313 | +const second = codexAppServerStartOptionsKey({ |
| 314 | +transport: "stdio", |
| 315 | +command: "codex", |
| 316 | +args: ["app-server"], |
| 317 | +headers: {}, |
| 318 | +env: { OPENAI_API_KEY: "sk-second" }, |
| 319 | +}); |
| 320 | + |
| 321 | +expect(first).not.toEqual(second); |
| 322 | +expect(first).not.toContain("sk-first"); |
| 323 | +expect(second).not.toContain("sk-second"); |
| 324 | +}); |
| 325 | + |
305 | 326 | it("keeps runtime config keys aligned with manifest schema and UI hints", async () => { |
306 | 327 | const manifest = JSON.parse( |
307 | 328 | await fs.readFile(new URL("../../openclaw.plugin.json", import.meta.url), "utf8"), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -304,7 +304,9 @@ export function codexAppServerStartOptionsKey(
|
304 | 304 | headers: Object.entries(options.headers).toSorted(([left], [right]) => |
305 | 305 | left.localeCompare(right), |
306 | 306 | ), |
307 | | -env: Object.entries(options.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)), |
| 307 | +env: Object.entries(options.env ?? {}) |
| 308 | +.toSorted(([left], [right]) => left.localeCompare(right)) |
| 309 | +.map(([key, value]) => [key, hashSecretForKey(value)]), |
308 | 310 | clearEnv: [...(options.clearEnv ?? [])].toSorted(), |
309 | 311 | authProfileId: params.authProfileId ?? null, |
310 | 312 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。