fix(security): harden runtime command override gating

This commit is contained in:
Peter Steinberger
2026-02-21 12:49:45 +01:00
parent cb84c537f4
commit fbb79d4013
12 changed files with 149 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
import type { SkillCommandSpec } from "../agents/skills.js";
import { isCommandFlagEnabled } from "../config/commands.js";
import type { OpenClawConfig } from "../config/types.js";
import { escapeRegExp } from "../utils.js";
import { getChatCommands, getNativeCommandSurfaces } from "./commands-registry.data.js";
@@ -96,13 +97,13 @@ export function listChatCommands(params?: {
export function isCommandEnabled(cfg: OpenClawConfig, commandKey: string): boolean {
if (commandKey === "config") {
return cfg.commands?.config === true;
return isCommandFlagEnabled(cfg, "config");
}
if (commandKey === "debug") {
return cfg.commands?.debug === true;
return isCommandFlagEnabled(cfg, "debug");
}
if (commandKey === "bash") {
return cfg.commands?.bash === true;
return isCommandFlagEnabled(cfg, "bash");
}
return true;
}