Repository navigation
fix(models): strip plaintext API keys from models.json - #83294
dzkjdxhbgog wants to merge 4 commits into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: this is a focused security-sensitive fix for prompt-visible provider credentials, and I found no blocking code defect in the diff, but current-head real behavior proof and maintainer policy review are still needed before merge. Canonical path: Close this PR as superseded by #83592. So I’m closing this here and keeping the remaining discussion on #83592. Review detailsBest possible solution: Close this PR as superseded by #83592. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main serializes finalProviders directly into models.json, while the PR test demonstrates the plaintext-key case and expected sanitized output. I did not run the proof locally because this review is read-only. Is this the best way to solve the issue? Mostly yes for the narrow Layer 1 boundary: a final persistence sanitizer is maintainable and well scoped. The unresolved choice is whether preserving legacy plaintext models.json auth is the intended compatibility bridge or should be replaced by a migration-first sibling. Security review: Security review cleared: Security-sensitive credential persistence was reviewed and I found no concrete new security or supply-chain regression in the patch itself. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5371b96af12b. |
|
@clawsweeper re-review I pushed 5b1095c to address the P1 data-loss concern: new plaintext provider keys are stripped, while existing merge-mode models.json plaintext auth is preserved until a maintainer-approved migration path exists. The PR body has updated proof and tests. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Hi maintainers, following up on this PR for #11829. The bot review currently says this needs human maintainer review mainly for the security/compatibility policy and ordering with #83296. Could you confirm whether this PR is still wanted/in scope for #11829 / the TaskBounty-linked work, and what change or decision is needed for acceptance? If this is no longer eligible for bounty/award because a different fix landed first, please let me know so I can close or redirect the work. |
5b1095c to
fdd8013
Compare
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
ClawSweeper applied the proposed close for this PR.
|
|
Thanks for the PR. I did a deeper pass through the OpenClaw + PI model-registry path and found one more issue: removing a newly generated plaintext I could not update this fork branch further because maintainer edits are disabled, so I recreated the corrected stack in #87166 with your commits plus a maintainer fixup. The replacement keeps plaintext secrets out of generated Proof on the replacement PR: Testbox-through-Crabbox For future PRs, enabling GitHub's "Allow edits by maintainers" lets us push small fixups directly while preserving your branch. |
Part of #11829.
Summary
apiKeyvalues from generatedmodels.jsonbefore writing it.OPENAI_API_KEYandsecretref-managedso env/secret-ref based provider setup keeps working.apiKeymarkers, including custom env var names such asOPENCLAW_MODEL_LITELLM_API_KEY.apiKeyvalues that already exist inmodels.jsonduring merge mode to avoid deleting a user's only current auth before a maintainer-approved migration path exists.models.jsonentries, and marker preservation.Real behavior proof
Behavior addressed: Generated
models.jsonno longer persists newly configured plaintext providerapiKeyvalues while preserving source-managed SecretRef markers and existing merge-mode plaintext auth entries.Real environment tested: Blacksmith Testbox through Crabbox on Linux/Node 24, plus focused local OpenClaw tests.
Exact steps or command run after this patch: Ran
pnpm check:changedthrough Testbox, then built the branch in Testbox and executedensureOpenClawModelsJsonagainst a temp agent directory seeded with merge-mode existing auth, one fresh plaintext provider, and one custom env SecretRef provider.Evidence after fix: Testbox
tbx_01ksktrrnfdbf54jx1fsjj87zfpassedpnpm check:changed. Testboxtbx_01kskv2nshbd6ej6venxpgg4r2passed build plus generated-models assertion and emitted{"customOmitted":true,"litellmMarker":"OPENCLAW_MODEL_LITELLM_API_KEY","existingPreserved":true,"litellmModels":["litellm-model"]}.Observed result after fix: Newly configured plaintext auth is omitted from generated
models.json, the custom env SecretRef marker is persisted, the pre-existing merge-mode plaintext entry is preserved, and the configured model row remains present.What was not tested: No migration from existing plaintext
models.jsonauth into a separate secret store; that still needs maintainer/security policy.Tests
node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-core.config.ts src/agents/models-config.applies-config-env-vars.test.ts src/agents/models-config.uses-first-github-copilot-profile-env-tokens.test.ts src/agents/models-config.runtime-source-snapshot.test.tsnode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfopnpm check:changedvia Testbox-through-Crabboxtbx_01ksktrrnfdbf54jx1fsjj87zfmodels.jsonreal scenario via Testbox-through-Crabboxtbx_01kskv2nshbd6ej6venxpgg4r2--mode local