crewai - 💡(How to fix) Fix feat: Add Sensitivity Ratchet hook for irreversible permission narrowing [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#5262Fetched 2026-04-08 02:51:35
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×2

I'd like to contribute a Sensitivity Ratchet integration for CrewAI that prevents AI agents from exfiltrating sensitive data by irreversibly narrowing permissions at runtime.

Root Cause

I'd like to contribute a Sensitivity Ratchet integration for CrewAI that prevents AI agents from exfiltrating sensitive data by irreversibly narrowing permissions at runtime.

Code Example

from agent_iam_ratchet.crewai import install_ratchet_hooks

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

Description

I'd like to contribute a Sensitivity Ratchet integration for CrewAI that prevents AI agents from exfiltrating sensitive data by irreversibly narrowing permissions at runtime.

The Problem

An agent with broad tool access can read confidential data and then write it to a lower-sensitivity channel. This "sensitivity mixing" attack has real CVEs:

  • EchoLeak (CVE-2025-32711) — M365 Copilot
  • ForcedLeak (CVSS 9.4) — Salesforce AgentForce

The Solution

The Sensitivity Ratchet uses before_tool_call hooks to enforce monotonic permission narrowing. Once an agent touches high-sensitivity data, write/delete/execute permissions are permanently removed for the session.

The existing PyPI package already includes a CrewAI integration via install_ratchet_hooks().

from agent_iam_ratchet.crewai import install_ratchet_hooks

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

Happy to submit a PR adding this as a built-in tool or documenting it as a community integration.

extent analysis

TL;DR

To prevent sensitivity mixing attacks, integrate the Sensitivity Ratchet into CrewAI using the install_ratchet_hooks function from the agent-iam-ratchet package.

Guidance

  • Review the install_ratchet_hooks function to understand how it enforces monotonic permission narrowing.
  • Verify that the sensitivity_map accurately reflects the sensitivity levels of the tools and data in your CrewAI setup.
  • Test the integration with various scenarios to ensure that the Sensitivity Ratchet correctly blocks write/delete/execute permissions after an agent touches high-sensitivity data.
  • Consider submitting a PR to add the Sensitivity Ratchet as a built-in tool or documenting it as a community integration to help others prevent similar attacks.

Example

from agent_iam_ratchet.crewai import install_ratchet_hooks
from agent_iam_ratchet import Sensitivity

# Define the sensitivity map for your tools and data
sensitivity_map = {
    "search_confidential_db": Sensitivity.CONFIDENTIAL,
    "search_public_db": Sensitivity.PUBLIC
}

# Install the ratchet hooks with the defined sensitivity map
cleanup = install_ratchet_hooks(
    session=session,
    sensitivity_map=sensitivity_map,
    on_blocked=lambda tool, s: print(f"BLOCKED: {tool}")
)

Notes

The effectiveness of the Sensitivity Ratchet depends on the accuracy of the sensitivity_map and the correct implementation of the on_blocked callback.

Recommendation

Apply the Sensitivity Ratchet integration using the install_ratchet_hooks function to prevent sensitivity mixing attacks in your CrewAI setup. This approach provides a proactive defense against data exfiltration without requiring significant changes to your existing codebase.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING