Skip to content

[Feature]: Support external tool authorization providers through trusted tool policy hooks #97998

Description

@dinpd

Summary

Document and, if needed, lightly extend the trusted policy/plugin approval surfaces so an installed plugin can act as an external policy decision provider before tools execute.

Problem to solve

OpenClaw already has useful local primitives for tool policy, sandboxing, exec approvals, plugin approvals, and trusted pre-tool policies. Those cover many cases well.

Some users and organizations also need a stateful or externally managed authorization provider before tools execute. Common examples include:

  • budget and loop controls across a run
  • data-flow and PII egress rules
  • idempotency checks for side effects
  • policy decisions managed outside the agent workspace
  • audit receipts that correlate proposed, approved, executed, and denied actions
  • provider- or gateway-side authorization contracts

Today this appears possible through api.registerTrustedToolPolicy(...) and plugin approvals, but the external-provider pattern is not yet a first-class documented path. That makes it harder to build portable integrations without reverse-engineering the intended event shape, approval behavior, and audit boundaries.

Proposed solution

Document and, if needed, lightly extend the trusted policy/plugin approval surface so a plugin can safely act as an external tool authorization provider.

A useful first pass could include:

  1. A docs page or example plugin for an external tool authorization provider.
  2. A recommended event-to-policy payload shape.
  3. Clarification on same-chat plugin approval routing.
  4. Guidance for mapping provider decisions into existing OpenClaw outcomes:
    • allow: return undefined/no-op
    • deny: return { block: true, blockReason }
    • challenge: return { requireApproval: ... }
  5. Additional context fields if they are missing from trusted policy events:
    • source channel
    • account id
    • peer/conversation id
    • thread id
    • authenticated sender/user id when available
  6. An audit/export hook or recommended after-tool-call pattern for execution receipts.
  7. A pre-model context contribution hook, if needed, for heartbeat/context budget enforcement before recurring context is added to the model prompt.

The goal is not to add a specific vendor or product to OpenClaw. The goal is to make this generic pattern clearer:

tool call proposed
  -> trusted policy provider evaluates action/context
  -> allow / deny / require approval
  -> approval uses OpenClaw's existing approval routes
  -> tool executes only after the decision

Alternatives considered

  • Rely only on local allow/deny policy. This is good for static policy, but weaker for stateful budgets, idempotency, cross-run risk, and externally managed policy.
  • Send users to an external approval dashboard. This adds friction and duplicates OpenClaw's existing channel/approval experience.
  • Add a vendor-specific integration. A generic trusted-policy provider pattern keeps OpenClaw extensible without coupling core behavior to one authorization system.
  • Fork or distribute a modified OpenClaw. That is heavier than documenting and hardening the existing plugin/policy surfaces.

Impact

Affected: users running OpenClaw with high-risk tools, external systems, browser actions, message sends, code execution, or MCP/provider tools.

Severity: Medium to high for teams that need policy enforcement before side effects, not just after-the-fact audit.

Frequency: Frequent in agent workflows that read sensitive context, send messages, edit files, execute commands, publish PR reviews, or call changing MCP/provider tools.

Consequence: Without a clear external authorization provider path, integrations either duplicate OpenClaw approval UX, implement brittle plugin-specific mappings, or avoid OpenClaw for regulated/high-risk tool execution.

Evidence/examples

I have been prototyping this pattern externally against OpenClaw-style trusted policy events. The useful test cases so far are:

  • secrets exfiltration: allow local analysis, block secret movement into browser forms
  • outbound message guard: map message-style tools to a send action and block customer data to external channels
  • MCP drift: detect new or changed MCP tools before exposing the tool surface
  • loop/context budget: challenge repeated tool calls and deny oversized heartbeat-like payloads at hard token caps

Reference implementation and runnable examples are here:

The most useful upstream gaps to validate are context-field completeness, audit/export guidance, and whether heartbeat/context-budget enforcement needs a pre-model context contribution hook.

Additional information

This is not intended as a security vulnerability report and is not asking OpenClaw to adopt AgentPass specifically. I am looking for maintainer feedback on the generic extension/documentation shape first.

If this direction fits the project, I can try a small docs/example PR showing a trusted policy plugin that calls an HTTP/local policy provider and maps allow/deny/approval-required decisions into existing OpenClaw behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.enhancementNew feature or requestimpact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions