fix(secrets): skip PLAINTEXT_FOUND for known non-secret apiKey markers#97622
Conversation
Exclude models.providers.*.apiKey values that match isNonSecretApiKeyMarker (e.g., lmstudio-local, ollama-local) from secrets audit plaintext warnings. Regression test covers marker bypass and real-key flagging. Closes openclaw#89233
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 28, 2026, 10:38 PM ET / 02:38 UTC. Summary PR surface: Source +7, Tests +61. Total +68 across 2 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Stored data model Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 15fc8812815e. Label changesLabel changes:
Evidence reviewedPR surface: Source +7, Tests +61. Total +68 across 2 files. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
@clawsweeper re-review I've added real CLI behavior proof to the PR body. The isolated `openclaw secrets audit --json` run now shows only `models.providers.openai.apiKey` flagged as plaintext, while `models.providers.lmstudio.apiKey = "lmstudio-local"` is no longer reported. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
openclaw#97622) Exclude models.providers.*.apiKey values that match isNonSecretApiKeyMarker (e.g., lmstudio-local, ollama-local) from secrets audit plaintext warnings. Regression test covers marker bypass and real-key flagging. Closes openclaw#89233
openclaw#97622) Exclude models.providers.*.apiKey values that match isNonSecretApiKeyMarker (e.g., lmstudio-local, ollama-local) from secrets audit plaintext warnings. Regression test covers marker bypass and real-key flagging. Closes openclaw#89233 (cherry picked from commit 00c9ac5)
openclaw#97622) Exclude models.providers.*.apiKey values that match isNonSecretApiKeyMarker (e.g., lmstudio-local, ollama-local) from secrets audit plaintext warnings. Regression test covers marker bypass and real-key flagging. Closes openclaw#89233
openclaw#97622) Exclude models.providers.*.apiKey values that match isNonSecretApiKeyMarker (e.g., lmstudio-local, ollama-local) from secrets audit plaintext warnings. Regression test covers marker bypass and real-key flagging. Closes openclaw#89233
openclaw#97622) Exclude models.providers.*.apiKey values that match isNonSecretApiKeyMarker (e.g., lmstudio-local, ollama-local) from secrets audit plaintext warnings. Regression test covers marker bypass and real-key flagging. Closes openclaw#89233
What Problem This Solves
Fresh OpenClaw installs that enable the LM Studio provider ship with
models.providers.lmstudio.apiKey: "lmstudio-local"as a placeholder. The local LM Studio server does not validate API keys, so this value is not a real secret, yetopenclaw security audit(andopenclaw secrets audit) emits aPLAINTEXT_FOUNDwarning for it. This trains users to ignore plaintext warnings, which can mask real credentials stored inline.Closes #89233.
Why This Change Was Made
The same
isNonSecretApiKeyMarker()helper already skips these known local-provider markers when auditingmodels.jsonprovider apiKeys (seesrc/secrets/audit.ts:381). However, theopenclaw.jsonconfig audit path incollectConfigSecrets()only skipped non-sensitive request headers; it did not apply the marker check tomodels.providers.*.apiKey.This change reuses the existing marker helper so that
lmstudio-local,ollama-local, and other known non-secret apiKey markers are treated consistently across bothmodels.jsonandopenclaw.jsonaudit paths.User Impact
sk-...) continue to be flagged exactly as before.Evidence
Local validation run against this branch:
Results:
The new regression test (
src/secrets/audit.test.ts) asserts that:models.providers.lmstudio.apiKey = "lmstudio-local"is not flagged.models.providers.ollama.apiKey = "ollama-local"is not flagged.models.providers.openai.apiKey = "sk-real-plaintext"is still flagged.Files changed:
src/secrets/audit.ts,src/secrets/audit.test.ts.