Lesson 05 · Developers

Setting agent permissions for a team: Allowed, Ask, Never

about 12 minutes

This lesson specifies an Allowed / Ask / Never permission system for agents precisely enough to implement or evaluate one: the policy model, evaluation semantics, where enforcement has to live, how to bind human approvals to exact actions, how to stop Ask from degrading into rubber-stamping, and what to log. A tested reference evaluator is included. By the end you should be able to write a team policy, reason about its failure modes, and test it against prompt injection.

Model

A permission decision answers: may subject S perform action A on resource R, under conditions C?

  • Subject: the agent’s own identity, plus the human it acts for. Google’s framework requires distinct identities for agents acting on behalf of teams, and that agents “be prevented from escalating their own privileges beyond explicitly pre-authorized scopes” [8].
  • Action: a tool plus a verb, at the finest granularity the tool exposes (mail.create_draft is not mail.send).
  • Resource: what the action targets: a mailbox, a path, a recipient domain, a destination origin.
  • Conditions: time window, data classification, session, approval state.
  • Effect: one of three.
    • Allowed: execute without interaction.
    • Ask: suspend; execute only with a valid, action-bound human approval.
    • Never: refuse; optionally remove the tool from the model’s view entirely.

Evaluation semantics

Three rules, each with a long pedigree.

1. Default deny. No matching rule means Never. Saltzer and Schroeder’s fail-safe defaults: a permission-based mechanism “tends to fail by refusing permission, a safe situation, since it will be quickly detected”, whereas an exclusion-based one “tends to fail by allowing access, a failure which may go unnoticed in normal use” [1].

2. Strictest effect wins. If any matching rule says Never, the answer is Never; else if any says Ask, Ask; else Allowed. Specificity does not override effect. This is the semantics Claude Code documents for its allow / ask / deny rules: “Rules are evaluated in order: deny, then ask, then allow. The first match in that order determines the outcome, and rule specificity doesn’t change the order”, so “an allow rule can’t carve an exception out of a deny rule” [7]. The benefit is monotonicity: adding a rule can only make the policy stricter or fill a gap, never silently open a hole under an existing deny.

3. Complete mediation. Every invocation is checked, every time, by a component the model cannot influence. Saltzer and Schroeder warn that “proposals to gain performance by remembering the result of an authority check be examined skeptically”, and that cached decisions must be updated when authority changes [1]. For agents this rules out “approved once for this session” shortcuts that outlive a policy change or revocation. OWASP LLM06 makes the same point in agent terms: implement authorisation in downstream systems “rather than relying on an LLM to decide if an action is allowed or not” [3].

A subtle design choice: Claude Code distinguishes a bare-tool deny, which “removes the tool from Claude’s context entirely, so Claude never sees it”, from a scoped deny such as Bash(rm *), which leaves the tool available and blocks matching calls [7]. Removing a tool shrinks the attack surface the model can be talked into probing. Prefer removal when an agent never needs a tool at all.

Reference evaluator

# Illustrative, tested reference implementation. Not a product's API.
from dataclasses import dataclass
from fnmatch import fnmatch
import hashlib, json, time, secrets

ORDER = ("never", "ask", "allowed")          # strictest effect wins; unlisted = never

@dataclass(frozen=True)
class Rule:
    effect: str          # "allowed" | "ask" | "never"
    tool: str            # glob, e.g. "mail.*"
    resource: str = "*"  # glob over the target, e.g. "recipient:*@coastline.example"

POLICY = {
    "inbox-agent": [
        Rule("allowed", "mail.read"),
        Rule("allowed", "mail.create_draft"),
        Rule("ask",     "mail.send", "recipient:*"),
        Rule("never",   "mail.forward", "recipient:*"),
        Rule("never",   "mail.send", "recipient:*@competitor.example"),
    ],
}

def decide(agent: str, tool: str, resource: str) -> str:
    matches = {r.effect for r in POLICY.get(agent, [])
               if fnmatch(tool, r.tool) and fnmatch(resource, r.resource)}
    for effect in ORDER:
        if effect in matches:
            return effect
    return "never"                                  # fail-safe default

assert decide("inbox-agent", "mail.read", "msg:123") == "allowed"
assert decide("inbox-agent", "mail.send", "recipient:jo@client.example") == "ask"
assert decide("inbox-agent", "mail.send", "recipient:x@competitor.example") == "never"
assert decide("inbox-agent", "calendar.create", "event:1") == "never"   # unlisted
assert decide("unknown-agent", "mail.read", "msg:1") == "never"         # unknown subject

Glob matching is a simplification; production systems need a canonical resource representation (normalised email addresses, resolved paths, registrable domains) or the matcher becomes the vulnerability. Path traversal and Unicode look-alike domains are the classic ways around naive string matching.

Making Ask sound

An approval is a capability: a short-lived authorisation to perform one specific action. It must be bound to that action, not to the agent or the session.

def action_digest(agent, tool, args) -> str:
    blob = json.dumps({"agent": agent, "tool": tool, "args": args}, sort_keys=True)
    return hashlib.sha256(blob.encode()).hexdigest()

def issue_approval(digest: str, approver: str, ttl_s: int = 300) -> dict:
    return {"digest": digest, "approver": approver, "expires": time.time() + ttl_s,
            "nonce": secrets.token_hex(8), "used": False}

def consume_approval(approval: dict, agent, tool, args) -> bool:
    ok = (not approval["used"] and time.time() < approval["expires"]
          and approval["digest"] == action_digest(agent, tool, args))
    if ok:
        approval["used"] = True                     # single use
    return ok

args = {"to": ["jo@client.example"], "subject": "Re: invoice", "body_sha256": "ab12..."}
ap = issue_approval(action_digest("inbox-agent", "mail.send", args), approver="mia")
assert not consume_approval(ap, "inbox-agent", "mail.send", {**args, "to": ["x@other.example"]})
assert consume_approval(ap, "inbox-agent", "mail.send", args)
assert not consume_approval(ap, "inbox-agent", "mail.send", args)   # replay refused

Properties this buys:

  • No time-of-check to time-of-use gap. The human approves a digest of the exact arguments. If the agent (or an injection) changes a recipient after approval, the digest no longer matches.
  • Single use and expiry. Approvals cannot be replayed or banked.
  • Attribution. The approver’s identity travels with the action into the audit record.
  • Separation of duties. Route Ask by action class to a named role. NIST SP 800-53 AC-5 requires defining access authorisations “to support separation of duties” [2], and Saltzer and Schroeder’s separation of privilege explains why: with two independent keys, “no single accident, deception, or breach of trust is sufficient” [1]. An agent that prepares payments and a partner who releases them is this principle.

What the approver sees matters as much as the binding. Render the canonical arguments, not the model’s summary of them: the model’s description of an action is model output, and therefore steerable by injected content.

Approval fatigue, quantified

The failure mode of Ask is habituation. Akhawe and Felt’s field study of over 25 million browser warning impressions found click-through rates ranging from about a tenth (Firefox malware and phishing) to 70.2% (Chrome SSL warnings at the time), and concluded that “the user experience of a warning can have a significant impact on user behavior” [4]. Böhme and Grossklags model attention as a shared, depletable resource, argue that interface tweaks alone don’t solve habituation, and conclude that “user interactions should be rationed in order to save the scarce resource of attention for the most important decisions” [5]. Anthropic reports the same dynamic in Claude Code, where constant approvals “can lead to ‘approval fatigue’”, and that sandboxing, which converts many Ask cases into a bounded Allowed, reduced prompts by 84% in internal use [6].

Engineering responses:

Technique Effect
Replace Ask with a bounded Allowed (sandboxed execution, drafts, staging) Removes low-value prompts entirely
Make remembered approvals as narrow as the prompt can display Claude Code only offers “don’t ask again” when the prompt “can show you everything they would allow” [7]
Batch related actions into one reviewable plan Fewer, richer decisions (cf. plan-then-execute [10])
Track approval rate and time-to-approve per rule A rule approved ~100% within a second is not being reviewed
Escalate unusual parameters (new recipient domain, large amount) Spends attention where risk changed

Use, reveal and destination binding for credentials

Credentials deserve their own verbs. “Use this login to sign in to portal.supplier.example” and “return this password to the agent” are different actions with different risks and should be separate rules, with reveal almost always Never. Bind use to a destination: OAuth resource indicators (RFC 8707) let a client name the resource server a token is for [11], and RFC 9700 recommends audience-restricting access tokens so each resource server can refuse tokens “not meant to be used for that particular resource server” [12]. The same idea applies to filled logins: a grant for one origin should not fill on another.

Scope, time and revocation

  • Per-session grants. NIST SP 800-207 tenet 3: access “is granted on a per-session basis”, with “the least privileges needed to complete the task”, and “authentication and authorization to one resource will not automatically grant access to a different resource” [9].
  • Expiry and review. SP 800-53 includes automatic removal or disabling of temporary accounts (AC-2(2)) and periodic review of assigned privileges (AC-6(7)) [2]. Give every grant an expiry; make renewal an explicit act.
  • Revocation is a feature to test. Measure the time from “revoke” to “next call refused”. With cached authorisation or long-lived tokens it is often longer than people assume.

Policy-level checks before deployment

Trifecta lint. For each agent, compute whether Allowed (or Ask) tools together provide private-data access, untrusted-content exposure and an egress channel [13]. If yes, require an explicit sign-off or break a leg.

Static reasoning. Because the policy is data, you can ask questions of it mechanically: “is there any path where inbox-agent can send to a domain outside the organisation without Ask?” AWS’s Zelkova shows this approach at scale, encoding access-policy semantics into SMT and using a solver to verify properties and compare policies [14]. A simple version is enumerating tool × resource-class combinations and asserting expected effects in CI.

Adversarial tests. Run the agent against injected content and assert on effects, not on model text. AgentDojo’s design, with security cases defined as an attacker goal plus an injection point and scored against environment state, is a good template [15].

Audit record

Log every decision, not just every execution. NIST SP 800-53 AU-3 requires records to establish event type, time, location, source, outcome and the identities associated with the event [2]; AC-6(9) adds logging the execution of privileged functions. For agents:

{
  "ts": "2026-11-13T09:42:10+08:00",
  "agent": "inbox-agent", "on_behalf_of": "mia@coastline.example",
  "tool": "mail.send", "resource": "recipient:jo@client.example",
  "args_digest": "sha256:9f2c...", "decision": "ask",
  "approval": {"approver": "mia", "issued": "09:41:55+08:00", "consumed": true},
  "outcome": "sent", "task_id": "triage-2026-11-13", "policy_version": "v14"
}

policy_version lets you answer “would this have been allowed under last month’s policy?” during incident review. Store digests rather than message bodies where the body contains personal information.

Worked example: a team policy

Coastline Accounting (eight staff) runs an inbox agent and a bookkeeping agent.

# Illustrative format
defaults: { effect: never }
agents:
  inbox-agent:
    owner: ops-lead
    acts_for: shared-inbox
    rules:
      - { tool: mail.read,         effect: allowed }
      - { tool: mail.create_draft, effect: allowed }
      - { tool: mail.send,         resource: "recipient:*@coastline.example", effect: allowed }
      - { tool: mail.send,         resource: "recipient:*", effect: ask, approver: sender-of-record }
      - { tool: mail.forward,      resource: "recipient:*", effect: never }
      - { tool: calendar.create,   effect: ask, approver: ops-lead }
    expires: 2027-02-13
  bookkeeping-agent:
    owner: partner-finance
    rules:
      - { tool: ledger.read,           effect: allowed }
      - { tool: ledger.suggest_match,  effect: allowed }
      - { tool: ledger.approve_recon,  effect: ask, approver: partner-finance }
      - { tool: payments.*,            effect: never }
      - { tool: supplier.bank_details.*, effect: never }
    expires: 2027-02-13

Note the interaction in the inbox rules. Internal sends match both the internal Allowed rule and the catch-all Ask rule; under strictest-wins semantics the result is Ask. If the team really wants internal sends to be Allowed, the catch-all must be rewritten to exclude internal recipients, a change that is visible and reviewable. This is the intended cost of monotonic semantics: exceptions have to be expressed as narrower rules, not as overrides.

Key takeaways

An Allowed / Ask / Never system is a policy engine outside the model, and its security rests on three classic properties: default deny, strictest-effect-wins evaluation that cannot be overridden by more specific allows, and complete mediation of every call without stale cached decisions. Ask is only as strong as its binding and its human: approvals should be single-use, short-lived capabilities tied to a digest of the exact action and rendered from canonical arguments rather than the model’s summary. Habituation is a measured, predictable failure, so engineer prompts away with bounded Allowed alternatives, narrow remembered approvals, plan-level review and approval-rate monitoring. Scope, expiry, destination binding and decision-level audit records turn the policy from a one-off configuration into something you can review, test with injected content and verify mechanically before it ships.

pass’s Chrome Web Store listing describes per-agent Allowed, Ask or Never choices for supported agents, with access that can be limited and revoked [16]. Its privacy policy adds that, for each connected agent, it records “approval and expiry times, and an audit receipt of each use”, and that “You can revoke an agent’s access at any time” [17].

Sources and further reading

  1. Saltzer, J. H., & Schroeder, M. D. (1975). The Protection of Information in Computer Systems. Proceedings of the IEEE, 63(9), 1278–1308. https://doi.org/10.1109/PROC.1975.9939 (web version: https://www.cs.virginia.edu/~evans/cs551/saltzer/)
  2. Joint Task Force. (2020; includes updates as of 10 December 2020). Security and Privacy Controls for Information Systems and Organizations (NIST SP 800-53 Rev. 5), controls AC-2(2), AC-5, AC-6, AC-6(7), AC-6(9), AU-3. NIST. https://csrc.nist.gov/pubs/sp/800/53/r5/upd1/final
  3. OWASP Gen AI Security Project. (2025). LLM06:2025 Excessive Agency. https://genai.owasp.org/llmrisk/llm062025-excessive-agency/
  4. Akhawe, D., & Felt, A. P. (2013). Alice in Warningland: A Large-Scale Field Study of Browser Security Warning Effectiveness. 22nd USENIX Security Symposium, 257–272. https://www.usenix.org/conference/usenixsecurity13/technical-sessions/presentation/akhawe
  5. Böhme, R., & Grossklags, J. (2011). The Security Cost of Cheap User Interaction. NSPW ’11, 67–82. https://doi.org/10.1145/2073276.2073284 (open copy: https://www.nspw.org/papers/2011/nspw2011-bohme.pdf)
  6. Dworken, D., & Weller-Davies, O. (2025, 20 October). Beyond permission prompts: making Claude Code more secure and autonomous. Anthropic Engineering. https://www.anthropic.com/engineering/claude-code-sandboxing
  7. Anthropic. (n.d.). Claude Code documentation: Permissions. https://code.claude.com/docs/en/permissions
  8. Díaz, S., Kern, C., & Olive, K. (2025). Google’s Approach for Secure AI Agents: An Introduction. Google. https://research.google/pubs/an-introduction-to-googles-approach-for-secure-ai-agents/
  9. Rose, S., Borchert, O., Mitchell, S., & Connelly, S. (2020). Zero Trust Architecture (NIST SP 800-207), Section 2.1 tenet 3. NIST. https://csrc.nist.gov/pubs/sp/800/207/final
  10. Beurer-Kellner, L., Buesser, B., Creţu, A.-M., Debenedetti, E., Dobos, D., Fabian, D., Fischer, M., Froelicher, D., Grosse, K., Naeff, D., Ozoani, E., Paverd, A., Tramèr, F., & Volhejn, V. (2025). Design Patterns for Securing LLM Agents against Prompt Injections. arXiv preprint. https://arxiv.org/abs/2506.08837
  11. Campbell, B., Bradley, J., & Tschofenig, H. (2020). Resource Indicators for OAuth 2.0 (RFC 8707). IETF. https://www.rfc-editor.org/rfc/rfc8707
  12. Lodderstedt, T., Bradley, J., Labunets, A., & Fett, D. (2025). Best Current Practice for OAuth 2.0 Security (RFC 9700), Section 2.3. IETF. https://www.rfc-editor.org/rfc/rfc9700
  13. Willison, S. (2025, 16 June). The lethal trifecta for AI agents. https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/
  14. Backes, J., Bolignano, P., Cook, B., Dodge, C., Gacek, A., Luckow, K., Rungta, N., Tkachuk, O., & Varming, C. (2018). Semantic-based Automated Reasoning for AWS Access Policies using SMT. FMCAD 2018. https://doi.org/10.23919/FMCAD.2018.8602994
  15. Debenedetti, E., Zhang, J., Balunović, M., Beurer-Kellner, L., Fischer, M., & Tramèr, F. (2024). AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents. NeurIPS 2024, Datasets and Benchmarks Track. https://arxiv.org/abs/2406.13352
  16. Primitive AI. (n.d.). primitive pass, Chrome Web Store listing. https://chromewebstore.google.com/detail/primitive-pass/kfbmepahbbjlhkgcapldmdmdbaodmgfl
  17. Primitive AI (PRIMITIVE AI LABS PTY LIMITED). (2026, 25 October). Primitive Pass Privacy Policy, section 03 (“AI agent access”). https://pass.primitiveai.com.au/privacy.html (primitive’s own statements; effective 25 October 2026)