-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
maybeRecoverSuspiciousConfigRead should validate .bak is not polluted with redacted values before restoring #68423
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Problem
OpenClaw's config self-healing mechanism (
maybeRecoverSuspiciousConfigRead) restores from.bakwhen the main config file appears suspicious, but does not validate whether.bakitself has been polluted with redacted values.This creates a pollution fixation chain:
"***"or"<prefix>…<suffix>") back into the main config (e.g. by reading redacted tool output →json.loads→ modifying a different field →json.dump)maintainConfigBackupscopies the polluted main file to.bakas-ismaybeRecoverSuspiciousConfigReadrestores from the polluted.bakEvidence
Real incident on 2026-04-18: A Hermes agent wrote redacted
"***"intoopenclaw.jsonapiKey fields. OpenClaw's backup chain.bak/.bak.1/.bak.2/.bak.3/.bak.4all got polluted (3 apiKey fields each). Only a backup from a week prior (bak-20260409-114830) was still clean. The system was 401-failing for ~14 hours before root cause was identified.Detection command:
Proposed Fix
1. Validate backups before restoring
2. Validate before creating backups (prevent pollution spread)
In
maintainConfigBackups, also runvalidateBackupNotPollutedon the source file before copying. If polluted, skip backup creation and alert — keep the last known-clean.bakintact.3. Multi-level backup rotation
Retain more than one level of history (e.g.
.bak/.bak.daily/.bak.weekly) so accidental pollution of recent backups still leaves a clean recovery path.4.
openclaw config validateCLIAdd a command that scans the main config + all backups for redact patterns and reports pollution state. Helps users detect silent pollution before it causes 401 storms.
Related