openclaw - ✅(Solved) Fix config.get returns unredacted API keys in sourceConfig and runtimeConfig [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59793Fetched 2026-04-08 02:40:27
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Participants
Timeline (top)
commented ×1

PR fix notes

PR #67679: fix: redact credentials in browser.cdpUrl config paths

Description (problem / solution / changelog)

What

Add browser.cdpUrl and browser.profiles.*.cdpUrl to the set of config paths recognized as sensitive URLs, so embedded credentials (query tokens like ?token=xxx and HTTP Basic auth user:pass@host) are properly redacted in config.get API responses.

Also regenerate the base schema artifact so shipped uiHints stay aligned with the updated sensitive-URL matcher and continue to expose the correct url-secret metadata for the new cdpUrl paths.

Why

Browser CDP URLs can embed authentication credentials in two documented formats:

  • Query token: https://chrome.browserless.io?token=<secret>
  • HTTP Basic auth: https://user:[email protected]

These paths bypassed all three redaction gates:

  1. Schema .register(sensitive) — not registered
  2. Path-name pattern match (/token$/i, /api.?key$/i, …) — cdpUrl does not match
  3. URL-path match (.baseUrl, .httpUrl, mcp.servers.*.url) — .cdpUrl was not listed

Fixes #67656.

Changes

  • src/shared/net/redact-sensitive-url.ts — Add .cdpUrl suffix check to isSensitiveUrlConfigPath() (3 lines)
  • src/shared/net/redact-sensitive-url.test.ts — Unit tests for isSensitiveUrlConfigPath() with cdpUrl paths
  • src/config/redact-snapshot.test.ts — Snapshot redact/restore round-trip tests covering:
    • browser.cdpUrl with query token + HTTP Basic auth
    • browser.profiles.*.cdpUrl with per-profile credentials
    • Bare cdpUrl addresses without credentials remain unchanged
  • src/config/schema.base.generated.ts — Regenerated the base schema artifact so shipped uiHints include url-secret metadata for browser.cdpUrl and browser.profiles.*.cdpUrl

Testing

  • pnpm build
  • pnpm check
  • node --import tsx scripts/generate-base-config-schema.ts --check
  • All 49 related tests pass (8 unit + 41 snapshot)
  • Tested: fully tested
Test CaseExpectedActualPASS
isSensitiveUrlConfigPath() recognizes .cdpUrlBoth cdpUrl paths treated as sensitiveUnit test passes
Redact browser.cdpUrl credentialsSecrets stripped, safe parts keptSnapshot passes (token + Basic auth)
Redact browser.profiles.*.cdpUrl credentialsProfile secrets stripped, round-trip safeSnapshot passes
Regenerated base schema artifacturl-secret tag on both cdpUrl paths--check passes after regeneration

AI Disclosure

This PR was AI-assisted (CodeBuddy / Claude). All code has been reviewed and understood by the author. Tests were written in TDD style (failing test first, then minimal implementation).

Changed files

  • CHANGELOG.md (modified, +2/-0)
  • extensions/browser/src/browser/server-context.availability.ts (modified, +3/-1)
  • extensions/browser/src/browser/server-context.ensure-browser-available.waits-for-cdp-ready.test.ts (modified, +36/-0)
  • src/config/redact-snapshot.test.ts (modified, +63/-0)
  • src/config/schema.base.generated.ts (modified, +2/-2)
  • src/gateway/server.config-patch.test.ts (modified, +56/-0)
  • src/shared/net/redact-sensitive-url.test.ts (modified, +6/-0)
  • src/shared/net/redact-sensitive-url.ts (modified, +3/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

config.get correctly redacts sensitive values in the parsed field (replacing them with __OPENCLAW_REDACTED__), but the sourceConfig and runtimeConfig fields in the same response contain plaintext API keys, bot tokens, and gateway auth tokens.

This means any agent session that calls config.get receives all credentials in cleartext within its context window, and they get persisted in session log files (.jsonl).

Steps to Reproduce

  1. Configure OpenClaw with API keys in openclaw.json (providers, bot tokens, etc.)
  2. In any agent session, call the config.get tool
  3. Observe that parsed fields show __OPENCLAW_REDACTED__
  4. Observe that sourceConfig and runtimeConfig fields contain plaintext keys ❌

Expected Behavior

All three fields (parsed, sourceConfig, runtimeConfig) should apply the same redaction logic for sensitive values.

Impact

  • Credentials exposed to agent context windows
  • Credentials persisted in session log files on disk
  • Potential for accidental leakage if session logs are shared or backed up

Environment

  • OpenClaw version: 2026.4.1
  • OS: macOS (Apple Silicon)

extent analysis

TL;DR

Modify the config.get tool to apply the same redaction logic to sourceConfig and runtimeConfig fields as it does to the parsed field.

Guidance

  • Review the config.get implementation to identify why redaction is only applied to the parsed field and not to sourceConfig and runtimeConfig.
  • Update the redaction logic to recursively process all fields in the response, ensuring sensitive values are replaced with __OPENCLAW_REDACTED__.
  • Verify the fix by repeating the steps to reproduce and checking that all three fields (parsed, sourceConfig, runtimeConfig) contain redacted sensitive values.
  • Consider adding additional logging or monitoring to detect any future instances of credential exposure.

Example

// Example of expected redacted response
{
  "parsed": {
    "api_key": "__OPENCLAW_REDACTED__"
  },
  "sourceConfig": {
    "api_key": "__OPENCLAW_REDACTED__"
  },
  "runtimeConfig": {
    "bot_token": "__OPENCLAW_REDACTED__"
  }
}

Notes

The provided information suggests a specific issue with the config.get tool, but without access to the implementation details, the exact fix may vary. It is essential to review the code and ensure that the redaction logic is correctly applied to all relevant fields.

Recommendation

Apply workaround by modifying the config.get tool to redact sensitive values in all fields, as this is a critical security issue that needs to be addressed promptly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING