Expand description
Context-policy-pack enforcement for the MCP server pipeline (GL #673).
Consults the resolved active policy (crate::core::policy::runtime) to
allow/deny tool calls, in addition to the super::role_guard. This is the
runtime half of Context Policy Packs v1 (GL #489), whose engine module ships
the format/validation/CLI and defers enforcement to here.
- Opt-in: with no active pack, every tool is allowed (current behavior).
- Local-Free: only the agent pipeline is constrained, never a human’s own local reads.
- No self-lockout: the
EXEMPT_TOOLSmeta tools can never be policy-denied, so an operator can always switch roles/policies back out.
Structs§
Functions§
- audit_
egress - Audit a blocked egress (write/action) DLP decision (GL #676).
Privacy-preserving: records the rule/class label (
forbidden-pattern:…,secret,pii:…,rate-limit) — never the matched content. - audit_
filter - Audit a content-filter decision (GL #675). Privacy-preserving: records
only the detector classes and counts (e.g.
pii:iban×2) — never the matched values. Ablockeddecision additionally surfaces a policy-violation event; redactions are recorded asSecretDetectedfor the compliance ledger. - check_
tool_ access - Check whether
tool_nameis allowed by the active policy pack, recording an audit entry on denial (same APIs assuper::role_guard). - into_
call_ tool_ result - redact_
result - Apply the active policy’s redaction patterns to outbound tool result text.
Returns the (possibly redacted) text and the number of redactions applied.
No-op (
hits == 0, original text) when no pack is active or it has no[redaction]block.