Skip to content

feat: Add Sensitivity Ratchet hook for irreversible permission narrowing #5262

@mattyopon

Description

@mattyopon

Description

This is a proposal to add documentation for a community-maintained hook integration that uses CrewAI's existing register_before_tool_call_hook API to implement a session-scoped permission-narrowing pattern for LLM agents.

It is explicitly not a novel research contribution — the underlying idea has ~50 years of formal security precedent (Denning 1976, Biba 1977) and several recent AI-agent-specific implementations published in 2025–2026 (see Related work below). The value proposition is that it gives a CrewAI user a 10-line-install of this pattern without having to wire up Fides, AIP, or the Agent Governance Toolkit themselves.

The threat model

Two recent real-world CVEs illustrate the class of attack this pattern addresses:

  • EchoLeak (CVE-2025-32711, M365 Copilot, zero-click prompt injection via email; disclosed June 2025). A compromised prompt causes the agent to read confidential user data and then write it to an attacker-controlled channel.
  • ForcedLeak (CVSS 9.4, Salesforce Agentforce, indirect prompt injection via Web-to-Lead form; disclosed September 2025). Same structural pattern: indirect injection → read sensitive CRM data → write to attacker-controlled URL.

In both cases the attacker exploits sensitivity mixing: the agent has legitimate read access to high-sensitivity data and legitimate write access to a lower-sensitivity channel. Neither capability is dangerous in isolation; the danger is in their composition at the wrong moment.

The pattern (not the novel idea — the practical hook)

The pattern is monotonic capability narrowing: once an agent touches data at a given sensitivity level within a session, its write/delete/execute scopes are permanently reduced for the rest of that session. This is the Biba integrity model (1977) applied to LLM tool calls.

The agent-iam-ratchet package (PyPI, GitHub, MIT) already includes a CrewAI integration using register_before_tool_call_hook:

from agent_iam_ratchet import RatchetSession, Sensitivity
from agent_iam_ratchet.crewai import install_ratchet_hooks

session = RatchetSession(scopes=["read:*", "write:*", "delete:*"])

cleanup = install_ratchet_hooks(
    session=session,
    sensitivity_map={"search_confidential_db": Sensitivity.CONFIDENTIAL},
    on_blocked=lambda tool, s: print(f"BLOCKED: {tool}"),
)

crew.kickoff()
cleanup()

It uses only public CrewAI hook APIs and has no dependency on private CrewAI internals.

Related work (honest prior art)

The ratchet/attenuation idea in this space already has substantial coverage. agent-iam-ratchet is not positioned as novel against any of these; it's a smaller, more opinionated CrewAI-specific alternative.

The pattern builds on ~50 years of formal security precedent (Denning 1976 lattice model, Biba 1977 integrity model, object-capability attenuation, Biscuit tokens). In the AI-agent space specifically:

Work Level agent-iam-ratchet positioning
Microsoft Fides (May 2025) Planner-level IFC, formal model, AgentDojo eval Fides has formal guarantees; we offer a simpler hook-level alternative
AIP / IBCTs (March 2026, IETF draft) Token-level scope attenuation, multi-hop delegation AIP handles cross-agent chains; we handle single-session
MS Agent Governance Toolkit (April 2026) Full-stack governance, 10/10 OWASP, <0.1ms p99 AGT is the full stack; we're one pattern at hook level
OWASP Agentic AI Top 10 (Dec 2025) ASI02 "capability sandboxing" We implement one instance of this mitigation

What I'm actually proposing for CrewAI

Given the above, not a code contribution to core. The concrete proposal is:

  1. A new page under docs/en/learn/ — for example, sensitivity-ratchet.mdx or more honestly capability-narrowing-patterns.mdx — that:

    • Explains the monotonic-narrowing pattern from Denning/Biba at a practitioner level
    • Shows how to implement it in CrewAI using the existing register_before_tool_call_hook API
    • Lists agent-iam-ratchet, Fides, AIP, and AGT as community / external options a CrewAI user can choose from, with honest strengths and weaknesses of each
    • Is explicitly tagged as community content, not built-in
  2. No changes to CrewAI core code. The existing hook API is already sufficient.

  3. No dependency addition. agent-iam-ratchet stays external.

I can open this as a docs-only PR whenever a maintainer says the framing is acceptable.

Edit note (2026-04-10)

The original version of this issue (filed 2026-04-03) framed agent-iam-ratchet as a novel approach to defend against EchoLeak/ForcedLeak. After @aeoess's comment and a subsequent prior-art sweep I realized I had not adequately searched for existing AI-agent IFC work. This revised body removes the novelty framing and repositions the proposal as a docs-only community integration alongside Fides, AIP, AGT, Biscuit, and Pidlisnyi's work. The original text is preserved in the issue history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions