openclaw - ✅(Solved) Fix [Bug]: config set accepts invalid key paths without error (e.g., agents.defaults.tools.fs.workspaceOnly) [2 pull requests, 2 comments, 3 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#50012Fetched 2026-04-08 01:00:18
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Timeline (top)
cross-referenced ×4commented ×2referenced ×1

openclaw config set accepts key paths that do not match the config schema, silently writing them to openclaw.json. The config is accepted but the setting has no effect because the runtime reads a different path.

Error Message

This FAILS with validation error (correct behavior):

openclaw config set agents.defaults.tools.fs.workspaceOnly true

Error: Config validation failed: agents.defaults: Unrecognized key: "tools"

This SUCCEEDS but writes to a different location:

openclaw config set tools.fs.workspaceOnly true

Updated tools.fs.workspaceOnly. Restart the gateway to apply.

Root Cause

openclaw config set accepts key paths that do not match the config schema, silently writing them to openclaw.json. The config is accepted but the setting has no effect because the runtime reads a different path.

Fix Action

Fixed

PR fix notes

PR #50075: fix(security): show exact workspaceOnly config command

Description (problem / solution / changelog)

Summary

  • update the open-group audit remediation to print the exact openclaw config set command
  • add regression coverage for the remediation text

Problem

The audit told users to set tools.fs.workspaceOnly=true, but not the exact command/path to run. That slows remediation and makes the fix easy to mistype.

Testing

  • pnpm vitest run src/security/audit.test.ts
  • pnpm exec oxlint src/security/audit-extra.sync.ts src/security/audit.test.ts

Closes #50012

Changed files

  • src/security/audit-extra.sync.ts (modified, +21/-2)
  • src/security/audit.test.ts (modified, +63/-0)

PR #4: fix: add path existence check for config set command

Description (problem / solution / changelog)

Add path existence check for config set command to warn when creating new keys. Closes #50012

Changed files

  • src/agents/models-config.providers.discovery.ts (modified, +2/-2)
  • src/cli/config-cli.ts (modified, +13/-1)
  • src/config/zod-schema.ts (modified, +10/-1)
  • src/daemon/schtasks.ts (modified, +5/-2)
  • src/discord/send.outbound.ts (modified, +4/-1)

Code Example

# This FAILS with validation error (correct behavior):
openclaw config set agents.defaults.tools.fs.workspaceOnly true
# Error: Config validation failed: agents.defaults: Unrecognized key: "tools"

# This SUCCEEDS but writes to a different location:
openclaw config set tools.fs.workspaceOnly true
# Updated tools.fs.workspaceOnly. Restart the gateway to apply.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

openclaw config set accepts key paths that do not match the config schema, silently writing them to openclaw.json. The config is accepted but the setting has no effect because the runtime reads a different path.

To reproduce

# This FAILS with validation error (correct behavior):
openclaw config set agents.defaults.tools.fs.workspaceOnly true
# Error: Config validation failed: agents.defaults: Unrecognized key: "tools"

# This SUCCEEDS but writes to a different location:
openclaw config set tools.fs.workspaceOnly true
# Updated tools.fs.workspaceOnly. Restart the gateway to apply.

Expected behavior

Either:

  1. Document the correct key path for workspaceOnly in openclaw security audit remediation text, OR
  2. Validate that the written key path actually affects runtime behavior (reject paths that write to dead config branches)

Actual behavior

  • agents.defaults.tools.fs.workspaceOnly → validation error (good)
  • tools.fs.workspaceOnly → accepted (but is this actually read by the runtime?)
  • No way for the user to know which path is correct without trial and error

Environment

  • OpenClaw: 2026.3.13
  • OS: macOS 26.3.1 (arm64)

Additional context

Found during security hardening. The security audit recommends setting tools.fs.workspaceOnly=true but does not specify the exact config key path. Users have to guess between agents.defaults.tools.fs.workspaceOnly and tools.fs.workspaceOnly.

extent analysis

Fix Plan

To fix this issue, we need to validate the written key path and ensure it affects runtime behavior. We can achieve this by:

  • Updating the openclaw config set command to check if the provided key path is valid and used by the runtime.
  • Documenting the correct key path for workspaceOnly in openclaw security audit remediation text.

Code Changes

We can add a validation step in the openclaw config set command:

def set_config(key_path, value):
    # Check if key path is valid and used by runtime
    if not is_key_path_valid(key_path):
        raise ValueError(f"Invalid key path: {key_path}")
    
    # Write to config file
    config = read_config()
    config[key_path] = value
    write_config(config)

def is_key_path_valid(key_path):
    # Check if key path is in the config schema
    schema = get_config_schema()
    return key_path in schema

We also need to update the openclaw security audit remediation text to include the correct key path:

To set `workspaceOnly` to `true`, run:
```bash
openclaw config set agents.defaults.tools.fs.workspaceOnly true

Verification

To verify the fix, we can test the openclaw config set command with different key paths:

# This should succeed
openclaw config set agents.defaults.tools.fs.workspaceOnly true
# This should fail with validation error
openclaw config set tools.fs.workspaceOnly true

Extra Tips

  • Make sure to update the documentation and remediation text to reflect the correct key path.
  • Consider adding a --dry-run flag to the openclaw config set command to allow users to test the validation without writing to the config file.

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…

FAQ

Expected behavior

Either:

  1. Document the correct key path for workspaceOnly in openclaw security audit remediation text, OR
  2. Validate that the written key path actually affects runtime behavior (reject paths that write to dead config branches)

Still need to ship something?

×6

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

Back to top recommendations

TRENDING