Skip to content

security(cli): redact sensitive values in config get output#23654

Merged
vincentkoc merged 3 commits intoopenclaw:mainfrom
SleuthCo:security/redact-config-get-v2
Feb 23, 2026
Merged

security(cli): redact sensitive values in config get output#23654
vincentkoc merged 3 commits intoopenclaw:mainfrom
SleuthCo:security/redact-config-get-v2

Conversation

@SleuthCo
Copy link
Contributor

@SleuthCo SleuthCo commented Feb 22, 2026

Summary

runConfigGet() reads raw config values but never applies redaction before printing. Running openclaw config get gateway.token leaks the real credential to the terminal — visible in shell history, scrollback, and screenshots.

This is a 1-line fix using the existing redactConfigObject() from redact-snapshot.ts (already used by the Web UI path) to scrub sensitive fields before output.

Supersedes #13777 (rebased against current HEAD after upstream refactored config get into runConfigGet()).

Fixes #13683

Changes

  • Import redactConfigObject from ../config/redact-snapshot.js
  • Apply redactConfigObject(snapshot.config) before getAtPath() in runConfigGet()

Test plan

  • openclaw config get gateway.token → prints __OPENCLAW_REDACTED__ instead of real token
  • openclaw config get gateway.token --json → prints "__OPENCLAW_REDACTED__"
  • openclaw config get agents → non-sensitive paths return real values unchanged

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Greptile Summary

This PR fixes a security vulnerability where openclaw config get commands leaked sensitive credentials (tokens, passwords, API keys) to terminal output, shell history, and screenshots. The fix applies the existing redactConfigObject() function from src/config/redact-snapshot.ts before retrieving the config value, ensuring sensitive fields are replaced with __OPENCLAW_REDACTED__ sentinel values.

  • Imported redactConfigObject from ../config/redact-snapshot.js in src/cli/config-cli.ts:4
  • Applied redaction to snapshot.config before getAtPath() in runConfigGet() at src/cli/config-cli.ts:236-237
  • The redaction logic is well-tested and already used by the Web UI path and other config endpoints
  • Sensitive field detection uses regex patterns matching token, password, secret, apiKey (with exceptions for fields like maxTokens)
  • Non-sensitive paths return actual values unchanged

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a targeted 2-line security patch that reuses existing, well-tested redaction infrastructure (redactConfigObject()) already used by the Web UI and gateway config endpoints. The change is minimal, focused, and follows established patterns in the codebase. The redaction function has comprehensive test coverage and handles edge cases (environment variable placeholders, whitelisted fields like maxTokens). No breaking changes or performance concerns.
  • No files require special attention

Last reviewed commit: 92dace9

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openclaw-barnacle openclaw-barnacle bot added cli CLI command changes size: XS labels Feb 22, 2026
@SleuthCo
Copy link
Contributor Author

@vincentkoc — small security follow-up to the prototype pollution fix you merged in #22213.

runConfigGet() (extracted in the recent refactor) reads raw config but never calls redactConfigObject() before printing. So openclaw config get gateway.token leaks the real credential to the terminal.

This is a 1-line fix using the existing redactConfigObject() from redact-snapshot.ts that's already wired into the Web UI path. Happy to adjust if needed.

Copy link
Member

@vincentkoc vincentkoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after validation.

I pushed two follow-ups to this PR branch:

  • Added a changelog entry under 2026.2.22 (Unreleased) -> Fixes
  • Added a regression test in src/cli/config-cli.test.ts for redacted config get output

Thanks @SleuthCo.

@vincentkoc vincentkoc merged commit 9c87b53 into openclaw:main Feb 23, 2026
24 checks passed
carlosrivera pushed a commit to myascendai/meshiclaw that referenced this pull request Feb 23, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
gabrielkoo pushed a commit to gabrielkoo/openclaw that referenced this pull request Feb 23, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
xianfeng92 pushed a commit to xianfeng92/openclaw that referenced this pull request Feb 24, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 26, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
(cherry picked from commit 9c87b53)

# Conflicts:
#	CHANGELOG.md
#	src/cli/config-cli.test.ts
#	src/cli/config-cli.ts
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
(cherry picked from commit 9c87b53)

# Conflicts:
#	CHANGELOG.md
#	src/cli/config-cli.test.ts
#	src/cli/config-cli.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…#23654)

* security(cli): redact sensitive values in config get output

`runConfigGet()` reads raw config values but never applies redaction
before printing. When a user runs `openclaw config get gateway.token`
the real credential is printed to the terminal, leaking it into shell
history, scrollback buffers, and screenshots.

Use the existing `redactConfigObject()` (from redact-snapshot.ts,
already used by the Web UI path) to scrub sensitive fields before
`getAtPath()` resolves the requested key.

Fixes openclaw#13683


* CLI/Config: add redaction regression test and changelog

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Sandboxed agents can read resolved API secrets via config

2 participants