mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-21 04:54:59 +00:00
security: remove global pre-tool capability hard block
This commit is contained in:
@@ -2,7 +2,6 @@ import type { ToolLoopDetectionConfig } from "../config/types.tools.js";
|
||||
import type { SessionState } from "../logging/diagnostic-session-state.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { getGlobalHookRunner } from "../plugins/hook-runner-global.js";
|
||||
import { checkToolAgainstSkillPolicy } from "../security/skill-security-context.js";
|
||||
import { isPlainObject } from "../utils.js";
|
||||
import { normalizeToolName } from "./tool-policy.js";
|
||||
import type { AnyAgentTool } from "./tools/common.js";
|
||||
@@ -81,20 +80,6 @@ export async function runBeforeToolCallHook(args: {
|
||||
const toolName = normalizeToolName(args.toolName || "tool");
|
||||
const params = args.params;
|
||||
|
||||
// Skill security enforcement — check before any plugin hooks.
|
||||
// This is a hard code gate: no prompt injection can bypass it.
|
||||
const skillPolicyBlock = checkToolAgainstSkillPolicy(toolName);
|
||||
if (skillPolicyBlock) {
|
||||
log.warn(`Tool blocked by skill policy: ${toolName}`, {
|
||||
category: "security",
|
||||
tool: toolName,
|
||||
reason: skillPolicyBlock,
|
||||
agentId: args.ctx?.agentId ?? null,
|
||||
sessionKey: args.ctx?.sessionKey ?? null,
|
||||
});
|
||||
return { blocked: true, reason: skillPolicyBlock };
|
||||
}
|
||||
|
||||
if (args.ctx?.sessionKey) {
|
||||
const { getDiagnosticSessionState } = await import("../logging/diagnostic-session-state.js");
|
||||
const { logToolLoopAction } = await import("../logging/diagnostic.js");
|
||||
|
||||
Reference in New Issue
Block a user