openclaw - ✅(Solved) Fix [Bug]: gateway.nodes.denyCommands silently accepts invalid command names without warning [2 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#50011Fetched 2026-04-08 01:00:20
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
cross-referenced ×4commented ×1referenced ×1

gateway.nodes.denyCommands accepts any string without validating against the actual command registry. Invalid command names (typos, wrong format) are silently ignored, giving users a false sense of security.

Error Message

openclaw config set gateway.nodes.denyCommands [...] should warn (or fail) when a command name is not in the known command registry, similar to how agents.defaults.tools validates tool names.

Root Cause

gateway.nodes.denyCommands accepts any string without validating against the actual command registry. Invalid command names (typos, wrong format) are silently ignored, giving users a false sense of security.

Fix Action

Fixed

PR fix notes

PR #50076: fix(config): validate denyCommands after gateway.nodes writes

Description (problem / solution / changelog)

Summary

  • validate gateway.nodes.denyCommands during openclaw config set before write
  • catch direct leaf writes plus ancestor-object writes such as gateway.nodes={...}
  • keep custom commands valid when they are introduced via allowCommands in the same update

Problem

denyCommands accepted unknown entries silently on config set. A typo like denyCommands=["sendd"] looked blocked but was ignored at runtime. Parent-object writes could also bypass an exact-leaf check.

Testing

  • pnpm vitest run src/config/validate-deny-commands.test.ts src/cli/config-cli.test.ts src/gateway/gateway-misc.test.ts
  • pnpm exec oxlint src/cli/config-cli.ts src/cli/config-cli.test.ts src/config/validate-deny-commands.ts src/config/validate-deny-commands.test.ts

Closes #50011

Changed files

  • src/cli/config-cli.test.ts (modified, +220/-0)
  • src/cli/config-cli.ts (modified, +52/-0)
  • src/config/validate-deny-commands.test.ts (added, +126/-0)
  • src/config/validate-deny-commands.ts (added, +161/-0)

PR #3: fix: add format validation for gateway.nodes.denyCommands

Description (problem / solution / changelog)

Summary

Add format validation for denyCommands config to prevent whitespace in command patterns.

Changes

  • src/config/zod-schema.ts: Added validator for denyCommands

Closes #50011

Changed files

  • src/agents/models-config.providers.discovery.ts (modified, +2/-2)
  • 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

{
  "gateway": {
    "nodes": {
      "denyCommands": ["camera.snap", "camera.clip", "reminders.add"]
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

gateway.nodes.denyCommands accepts any string without validating against the actual command registry. Invalid command names (typos, wrong format) are silently ignored, giving users a false sense of security.

To reproduce

  1. Set gateway.nodes.denyCommands to include invalid names:
{
  "gateway": {
    "nodes": {
      "denyCommands": ["camera.snap", "camera.clip", "reminders.add"]
    }
  }
}
  1. Run openclaw security audit
  2. Observe: audit catches the issue, but config set accepted it without any warning

Expected behavior

openclaw config set gateway.nodes.denyCommands [...] should warn (or fail) when a command name is not in the known command registry, similar to how agents.defaults.tools validates tool names.

Alternatively, openclaw security audit --fix could offer to auto-correct invalid entries.

Actual behavior

  • config set silently accepts invalid command names
  • Only security audit detects the problem after the fact
  • User may believe they have blocked sensitive commands when they have not

Environment

  • OpenClaw: 2026.3.13
  • OS: macOS 26.3.1 (arm64)
  • Install: pnpm (stable channel)

Additional context

Found during security hardening. The audit output helpfully suggests corrections (e.g., "camera.snap — did you mean: camera.list") but this validation should happen at config write time, not only during audit.

extent analysis

Fix Plan

To address the issue, we need to validate the denyCommands configuration against the actual command registry. We can achieve this by modifying the config set command to check for valid command names.

Step-by-Step Solution

  1. Update the config set command:

    • Before saving the new configuration, iterate through the denyCommands list and check each command name against the command registry.
    • If an invalid command name is found, display a warning or error message and prevent the configuration from being saved.
  2. Implement command validation:

    • Create a function that takes a command name as input and returns a boolean indicating whether the command is valid.
    • Use this function to validate each command name in the denyCommands list.

Example Code (JavaScript)

// Command registry
const commandRegistry = {
  'camera.snap': true,
  'camera.list': true,
  'reminders.add': true,
  // ... other commands ...
};

// Function to validate a command name
function isValidCommand(commandName) {
  return commandRegistry[commandName] !== undefined;
}

// Validate denyCommands configuration
function validateDenyCommands(denyCommands) {
  const invalidCommands = denyCommands.filter(command => !isValidCommand(command));
  if (invalidCommands.length > 0) {
    console.warn(`Invalid command(s) found: ${invalidCommands.join(', ')}`);
    return false;
  }
  return true;
}

// Example usage
const denyCommands = ['camera.snap', 'camera.clip', 'reminders.add'];
if (validateDenyCommands(denyCommands)) {
  // Save the configuration
  console.log('Configuration saved successfully');
} else {
  console.log('Invalid configuration. Please correct the denyCommands list.');
}

Verification

To verify that the fix worked, follow these steps:

  1. Set gateway.nodes.denyCommands to include an invalid command name.
  2. Run openclaw config set and observe the output.
  3. The command should display a warning or error message indicating that an invalid command name was found.
  4. Correct the denyCommands list and run openclaw config set again.
  5. The configuration should be saved successfully.

Extra Tips

  • Consider implementing auto-correction for invalid command names, as suggested by the security audit output.
  • Regularly review and update the command registry to ensure it remains accurate and comprehensive.

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

openclaw config set gateway.nodes.denyCommands [...] should warn (or fail) when a command name is not in the known command registry, similar to how agents.defaults.tools validates tool names.

Alternatively, openclaw security audit --fix could offer to auto-correct invalid entries.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: gateway.nodes.denyCommands silently accepts invalid command names without warning [2 pull requests, 1 comments, 2 participants]