CSE Roadmap

Core tier · about 5 hours · 14 parts

Part 2 of 14 · 2 min read

Narrow tools say less, so there is less to abuse

A tool that cannot express a dangerous request cannot be talked into making one.

Think of a hotel key card. It opens your room, for the nights you booked, and nothing else. If someone steals it, they get one room, not the building.

In plain words: least privilege means a caller should have only the permissions it needs for the job it is doing now. The strongest way to enforce that is to make the dangerous request impossible to even express. A request that is merely denied after being asked for is weaker.

A worked example. The same support job can be offered to a model as one sql_exec(sql) tool (designs A and B) or as seven narrow tools (design C): get_ticket, list_open_tickets, add_note, close_ticket, refund, get_payment, list_customers. Design C has no tool that can drop a table, delete a payment, or change an email address. Running eight attack requests through a poisoned ticket, design A lets all 8 through; design C's narrow tools, paired with a task-scoped grant, let 0 of 8 through, because the dangerous calls were never offered as options.

The key lines. From code/mini-privilege/toolsets.py:

# from code/mini-privilege/toolsets.py
def _ticket_row_check(desk, grant, args):
    r = desk.rw.execute("SELECT customer_id FROM tickets WHERE id=?", (args["ticket_id"],)).fetchone()
    if r is None:
        return f"Error: no ticket {args['ticket_id']}."
    if r[0] != grant.customer_id:
        return f"Error: ticket {args['ticket_id']} is not part of this conversation's customer."
    return None

Read it as: the check runs against grant.customer_id, a value your own code set, never a value the model supplied. get_ticket(ticket_id) takes no customer_id argument at all, so there is nothing for a poisoned ticket to override. The row scope comes from the grant, not from anything the model is asked to choose.

Least privilege

A caller should have only the permissions it needs for the job it is doing now, and no more. For an agent, "the caller" is the agent acting on a particular task. A "permission" is anything a tool lets it read, change, spend or send.

Example: list_open_tickets() takes no customer_id parameter precisely because the model does not need to choose it. Every argument a tool leaves out is one the model cannot get wrong or be tricked into setting.