mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 04:01:37 +00:00
refactor(security): unify command gating and blocked-key guards
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { handleBashChatCommand } from "./bash-command.js";
|
||||
import { rejectUnauthorizedCommand } from "./command-gates.js";
|
||||
import type { CommandHandler } from "./commands-types.js";
|
||||
|
||||
export const handleBashCommand: CommandHandler = async (params, allowTextCommands) => {
|
||||
@@ -13,9 +13,9 @@ export const handleBashCommand: CommandHandler = async (params, allowTextCommand
|
||||
if (!bashSlashRequested && !(bashBangRequested && command.isAuthorizedSender)) {
|
||||
return null;
|
||||
}
|
||||
if (!command.isAuthorizedSender) {
|
||||
logVerbose(`Ignoring /bash from unauthorized sender: ${command.senderId || "<unknown>"}`);
|
||||
return { shouldContinue: false };
|
||||
const unauthorized = rejectUnauthorizedCommand(params, "/bash");
|
||||
if (unauthorized) {
|
||||
return unauthorized;
|
||||
}
|
||||
const reply = await handleBashChatCommand({
|
||||
ctx: params.ctx,
|
||||
|
||||
Reference in New Issue
Block a user