Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 12, 2026, 12:04 PM ET / 16:04 UTC. ClawSweeper reviewWhat this changesThe PR lets the secrets audit accept a generated bare environment-variable name only when the winning config entry for that provider has the same environment SecretRef. Merge readinessKeep open: current main still has the audit false positive, but this PR introduces a blocking runtime import cycle while fixing it. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw generates per-agent models.json from configured model providers, then the secrets audit scans it for persisted credentials. This change compares the generated marker with provider configuration provenance before deciding whether it is plaintext. flowchart LR
A[Provider config] --> B[Provider key winner]
B --> C[Generated models.json]
C --> D[Secrets audit]
B --> E[SecretRef provenance]
E --> D
D --> F[Audit findings]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +27, Tests +158. Total +185 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Extract the provider-key winner normalizer into a dependency-leaf module shared by merge, source-managed projection, and audit provenance, then rebase and verify the exact head. Do we have a high-confidence way to reproduce the issue? Yes: current main writes an env SecretRef id to models.json, while the audit only accepts known marker names and flags custom bare names as plaintext. Is this the best way to solve the issue? No: sharing the generator’s precedence rule is right, but importing the merge module from the marker module creates a forbidden runtime cycle; a leaf helper is safer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 28a5889e9bd0. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Custom env SecretRefs (e.g. "${FACTCHAT_API_KEY}") are persisted in
models.json as bare env-var names ("FACTCHAT_API_KEY"), but the secrets
audit only recognized known env markers, so custom variables were
misreported as plaintext and the runtime resolver treated the name itself
as a literal key.
Recognize bare env-var name markers in collectModelsJsonSecrets when they
are backed by an env value or a matching env SecretRef in openclaw.json,
and resolve them from the environment in resolveUsableCustomProviderApiKey
instead of returning the name as a literal credential. Unbacked all-caps
strings still surface as plaintext.
Closes openclaw#121543
…e change Address ClawSweeper review findings (P1 + P2): P1 — Revert model-auth-provider-config.ts runtime branch: resolveUsableCustomProviderApiKey receives canonical config, not models.json. The bare env-var name shape check would have turned existing literal all-caps keys into ambient environment credentials, breaking the literal-key contract. P2 — Narrow audit suppression to the audited provider: isBareEnvVarNameApiKeyMarker now requires the same providerId's canonical config to declare a matching env SecretRef. A literal key in one models.json provider is no longer hidden when a different provider uses that env id (cross-provider regression test added). Also fixes check-dependencies: remove unused BARE_ENV_VAR_NAME_RE export.
Move isBareEnvVarNameApiKeyMarker to model-auth-markers.ts so audit.ts stays under the 700 effective-line lint limit. The helper now resolves the provider's canonical config SecretRef internally, keeping the audit call site to a single expression. No behavior change.
36eec3a to
589d74f
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
9a0b985 to
6787cf9
Compare
Address ClawSweeper P2+P3 findings:
P2 — Replace the custom resolveProviderEntry with the existing
resolveMergedModelProviderConfig() so duplicate-whitespace provider
keys are merged correctly (e.g. "custom" literal + " custom " env
SecretRef → generation emits ENV, lookup now reads the merged entry
with the SecretRef, not the literal). This also removes the parallel
provider-key resolution path.
P3 — Remove the duplicate unbacked-marker test ("still flags bare
all-caps apiKey when no config SecretRef matches") that reasserts the
existing arbitrary-all-caps case without exercising the new provenance
path. Same-provider, cross-provider, and mixed-case boundary tests are
retained.
Also reduces audit.ts to 700 effective lines to satisfy max-lines.
6787cf9 to
a745432
Compare
Address ClawSweeper P1 finding: resolveMergedModelProviderConfig selects the first normalized provider entry, but models.json generation gives exact canonical spelling priority and otherwise keeps the later alias. This mismatch could suppress a real plaintext finding when conflicting aliases use the same normalized key. Use normalizeProviderMapKeys (the generator's canonical key-winner rule) so audit provenance and models.json generation select the same provider entry. Add a conflicting-alias regression test. Also reduces audit.ts to 695 effective lines (under the 700 limit) by merging consecutive continue guards.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks @LiuwqGit. Closing this pull request as superseded by the earlier canonical repair at #121578 for #121543. Both branches take the correct audit-side approach, but this exact head introduces the runtime import cycle Important: nothing from this cluster has landed yet. #121578 remains open and still needs reconciliation against current Thank you for the repeated review iterations and the alias-precedence hardening. If the canonical branch is abandoned, this thread can be revisited. |
What Problem This Solves
Fixes #121543. Custom env SecretRefs (e.g.
"${FACTCHAT_API_KEY}") are persisted inmodels.jsonas bare env-var names ("FACTCHAT_API_KEY"), but only known env markers (e.g.OPENAI_API_KEY) were recognized by the secrets audit — custom variables were misreported as plaintext (PLAINTEXT_FOUND).Changes
src/agents/model-auth-markers.ts: addisBareEnvVarNameApiKeyMarker()that checks the same provider's config declares a matching env SecretRef. UsesnormalizeProviderMapKeys(the generator's canonical key-winner rule) so audit provenance and models.json generation select the same provider entry — exact canonical spelling wins, otherwise the later alias wins. No parallel provider-key resolution path.src/secrets/audit.ts:collectModelsJsonSecretsrecognizes a bare env-var-name apiKey as a marker when the same provider's config has a matching env SecretRef. No runtime/auth-resolver change.Evidence
Before fix (on
main)Ran
runSecretsAuditwith the exact issue #121543 scenario:openclaw.jsonconfigures"${FACTCHAT_API_KEY}"as env SecretRef;models.jsonregenerates with bare"FACTCHAT_API_KEY".After fix (this PR, commit 82c47a6)
Same scenario, same files:
The bare env-var name
"FACTCHAT_API_KEY"is now recognized as a marker because the same provider (custom-factchat) declares a matching env SecretRef inopenclaw.json. No real secret values are exposed.Boundary safety (test output)
CI status
check-dependencies(knip): ✅ pass (no unused exports)check-test-types(tsgo): ✅ passcheck-lint(oxlint): ✅ pass (audit.ts 695 effective lines, under 700 limit)PR context and evidence: ✅ passCritical Quality (core-auth-secrets): ✅ passTests
src/secrets/audit.test.tssrc/agents/models-config.providers.secrets.bedrock-apikey.test.tsFull suite: audit 33 ✓ | model-auth 164 ✓ | bedrock-apikey 12 ✓ | model-auth-markers 52 ✓ | auth-provenance 42 ✓
Review items addressed
normalizeProviderMapKeys(generator's canonical key-winner rule) so audit and generation select the same provider entry.model-auth-provider-config.tsis unchanged.isBareEnvVarNameApiKeyMarkerrequires the sameproviderId's config SecretRef.runSecretsAuditCLI output above demonstrates before/after behavior.Compatibility
Keeps the existing persisted format (bare env var name). No runtime behavior change. Only audit classification is narrowed.