Mental model
A language model acts strictly as an untrusted proposer emitting structured intent; an independent Policy Enforcement Point (PEP) intercepts every call and queries a deterministic Policy Decision Point (PDP) over verified caller identity, attenuated OAuth scopes, object relationships, parameter bounds, and action consequence under default-deny semantics before touching any backend system.
Learning outcomes
- Separate probabilistic tool planning in the model runtime from deterministic policy enforcement at the Policy Enforcement Point.
- Apply default-deny IAM evaluation order (
ExplicitDenybeforeExplicitAllow) alongside ABAC and ReBAC ownership checks. - Attenuate OAuth 2.0 capability tokens using narrow scopes, audience binding, and sender constraints to neutralize confused-deputy attacks.
- Bound blast radius across risk tiers with parameter-level invariants, cumulative budgets, and out-of-band human approvals.
Theory
In zero-trust architectures described by NIST SP 800-207, no network location, prompt prefix, or prior conversation turn confers implicit trust. When an AI agent retrieves external web pages, support tickets, or database rows, indirect prompt injection can coerce the model into proposing tool invocations with forged identifiers, inflated monetary amounts, or unintended cross-tenant lookups. Binding authorization solely at session login fails because the threat arrives inside data read mid-turn.
Deterministic tool authorization enforces four layered checks on every execution boundary. First, identity and tenant binding injects the caller's cryptographic sub, tenant_id, and session attributes directly from verified server session state—never from arguments generated by the model. Second, default-deny policy evaluation mirrors AWS IAM evaluation logic across identity-based RBAC, attribute-based ABAC conditions (environment, time window, risk posture), and relationship-based ReBAC graph edges (ticket.assignee == caller.sub). Any matching explicit deny immediately terminates evaluation regardless of broad allow policies.
Third, capability token attenuation follows OAuth 2.0 Security Best Current Practice (RFC 9700). Instead of forwarding a user's long-lived wildcard bearer token into downstream tool adapters, the gateway exchanges or downscopes credentials into short-lived, audience-restricted tokens (aud = billing-refund-api) bound to sender-constrained proof-of-possession (DPoP or mTLS) and strictly intersected scopes. Even if a downstream microservice or sandbox leaks its credential, the token cannot be replayed against unrelated APIs.
Fourth, parameter-level constraint checking and blast-radius tiers inspect the concrete payload before dispatch. Formally, effective authority for a call is the set intersection after explicit denials:
And expected single-turn operational risk combines compromise probability , tier impact , and deterministic gate coverage :
Once crosses irreversible thresholds (bulk exports, wire transfers, IAM mutations), relying solely on model alignment leaves unbounded unless deterministic validation () or signed out-of-band human confirmation gates execution.
Worked quantitative example
Suppose a customer support agent handles 40,000 tickets per day using a refund tool, and adversarial payloads hidden in retrieved emails trigger unauthorized refund attempts on 0.2% of tickets (80 attempts per day). Without parameter bounds or ReBAC assignment checks, a confused-deputy call issuing \$5,000 refunds per incident creates a daily exposure of 80 * \$5,000 = \$400,000.
Now place the refund tool in Tier 1 (Bounded State Mutation) with three deterministic controls: ReBAC checks require ticket.tenant_id == caller.tenant_id and ticket.assignee == caller.sub, parameter bounds cap refunds at \$250 maximum, and a rolling tenant rate limiter caps autonomous Tier 1 refunds at 10 per operator per day (\$2,500 ceiling). Because 95% of injected tickets fail the assignee or tenant ownership check at the PEP (C_gate = 0.95), at most 4 valid-assignee injections remain, each capped at \$250 (\$1,000 worst-case daily exposure, a 99.75% blast-radius reduction), while requests above \$250 pause for signed supervisor approval. Evaluated locally with cached ReBAC tuples, the PDP check adds under 4ms at P95 against a 2,000ms LLM turn.
Blast-radius tiers and authorization controls
| Blast-Radius Tier | Example Tool Action | Scope & Token Attenuation | Parameter & Ownership Checks | Execution Gate |
|---|---|---|---|---|
| Tier 0: Scoped Read | Search assigned customer tickets | Read-only aud, 60s TTL token | Tenant ID & ACL tuple match | Autonomous PEP allow |
| Tier 1: Bounded Write | Issue goodwill refund up to \$250 | Single-endpoint downscoped token | Numeric ceiling, idempotency key, daily quota | Autonomous PEP + audit log |
| Tier 2: High-Impact Write | Refund above \$250, delete org, rotate keys | Step-up auth token, single-use nonce | Target diff summary, non-delegable actor | Out-of-band human sign-off |
Trade-offs
Fine-grained per-call PEP checks with attenuated tokens and ReBAC lookups sharply contain blast radius, auditability, and cross-tenant data exfiltration, yet they add policy authoring overhead, schema versioning discipline, and denial-handling UX complexity. When a PEP rejects an action, the runtime must return structured, non-sensitive denial reasons so the model can recover or escalate without leaking policy internals.
Coarse session-wide credentials and static tool allowlists minimize integration glue in early prototypes, but they collapse authorization granularity onto the prompt boundary. Any single indirect prompt injection or misparsed argument turns into silent privilege escalation—the classic confused-deputy vulnerability where a high-privilege tool service obeys an untrusted model input on behalf of an unwitting user. Similarly, caching policy decisions across turns cuts PDP latency, yet stale caches after role revocation create a dangerous revocation gap unless TTLs stay short (under 30 seconds) or revocation events invalidate sessions synchronously.
Failure modes and misconceptions
- Authorizing only when the session starts. Checking roles once during chat initialization ignores the fact that retrieved RAG documents or tool outputs introduce adversarial instructions mid-conversation. Every single tool call must pass fresh PEP evaluation over its live arguments.
- Passing raw OAuth tokens inside model context. Injecting bearer tokens or API keys into prompts or tool schemas exposes credentials to prompt exfiltration and downstream replay. Keep credentials strictly inside the server-side PEP/adapter vault and attenuate scopes per target audience.
- Allowing the model to assert
user_idortenant_idparameters. Trusting identity fields generated inside tool JSON lets prompt injection spoof arbitrary tenants. Overwrite actor and tenant context exclusively from signed server session claims before policy evaluation. - Failing open when the PDP or IAM service times out. Falling back to permissive execution during policy-store latency spikes turns transient outages into full authorization bypasses. Always enforce fail-closed defaults with bounded circuit breakers.
- Relying on tool names or read-only descriptions instead of enforcing side-effect boundaries. Labeling a SQL runner or HTTP client as
read_onlyin its prompt docstring does not preventPOSTmutations orDROP TABLEstatements unless transport verbs, database roles, and parameter schemas enforce immutability deterministically.
Decision scenario
A fintech support assistant can read any ticket within a regional support queue during triage, yet company compliance mandates that only the currently assigned operator may issue refunds up to \$250, while refunds above \$250 or cross-region refunds require supervisor sign-off. The team initially considers hiding the refund tool definition when a ticket belongs to another operator and using a single shared service API key for all billing calls.
Reject hiding tool schemas as your primary control because prompt injection can still hallucinate tool calls or swap ticket IDs after lookup. Instead, route every execution through a fail-closed PEP that injects caller.sub and caller.tenant from the verified OAuth session, strips any caller-supplied actor fields, queries the ReBAC ticket-assignment ledger, enforces explicit deny rules on suspended accounts, attenuates a 30-second audience-bound token (aud=billing-service, scope=refund:write), enforces 0 below amount_cents at most 25000, and suspends requests exceeding the cap into a signed Tier 2 supervisor approval workflow.
Implementation example
This deterministic Python PEP/PDP evaluator enforces default-deny ordering (ExplicitDeny before ExplicitAllow), server-injected identity binding, attenuated audience/scope checks, ReBAC ownership matching, and Tier 1 parameter ceilings before dispatching a tool adapter.
pythonfrom dataclasses import dataclass@dataclass(frozen=True)class VerifiedSession:sub: strtenant_id: strroles: frozenset[str]token_aud: strtoken_scopes: frozenset[str]explicit_denies: frozenset[str]def authorize_tool_call(session: VerifiedSession, tool: str, target_tenant: str, assignee: str, cents: int) -> tuple[str, str]:if session.token_aud != "billing-refund-api":return "DENY", "token_audience_mismatch"if f"tool:{tool}" in session.explicit_denies:return "DENY", "explicit_deny_policy_matched"if target_tenant != session.tenant_id:return "DENY", "cross_tenant_confused_deputy_blocked"if tool != "issue_refund" or "refund:write" not in session.token_scopes:return "DENY", "missing_attenuated_scope"if "support_agent" not in session.roles or assignee != session.sub:return "DENY", "rebac_assignee_ownership_failed"if cents <= 0:return "DENY", "invalid_refund_amount"if cents > 25_000:return "REQUIRE_HUMAN_APPROVAL", "exceeds_tier1_250_usd_cap"return "ALLOW", "pep_verified_tier1_refund"sess = VerifiedSession("op-42", "ten-9", frozenset({"support_agent"}), "billing-refund-api", frozenset({"refund:write"}), frozenset())assert authorize_tool_call(sess, "issue_refund", "ten-9", "op-42", 18_500)[0] == "ALLOW"assert authorize_tool_call(sess, "issue_refund", "ten-9", "op-99", 5_000)[0] == "DENY"
Why does binding a Policy Enforcement Point to signed session identity and explicit deny rules prevent confused-deputy privilege escalation under prompt injection?