Security
Authority decides what an agent may do and keeps the record. This page lists the threats it is designed against, the control for each, and what remains your responsibility. To report a vulnerability, follow SECURITY.md.
Threat model
| Threat | Control |
|---|---|
| The model talks its way into a write | Letters are in the registry and rules; the gate never reads the model’s text for permission |
| A message the model reads carries an instruction | Intents refuse writing calls for the request; the gate decides in code |
| A new tool acts before anyone looked at it | Unknown tools are B |
| Two approvers run the same write twice | approve claims with one conditional update; only one claim succeeds |
| A parked call is replayed with changed arguments | The queue stores the original arguments; run receives them unchanged |
| The record of what happened is rewritten | The decisions table refuses UPDATE and DELETE by trigger |
| One company sees another’s queue | Every statement filters on the tenant; one instance per tenant |
| SQL injection through tool names or arguments | Every value is a bound parameter; identifiers are constants; a static test checks it |
| A store outage lets a call through | A store failure is a failed decision and a refusal message, never an allow |
| A rule throws and allows by accident | A throwing rule is treated as “unknown”: the call parks |
What stays yours
- Who approves.
approve(id, by, run)trusts thebyyou pass. Authenticate the approver in your handler and check their role before you call it. - The replay.
runis your function. Make it idempotent where the provider is not, and have it reuse an idempotency key when the provider offers one. - The preview. The queue stores arguments; rendering a human-readable preview is your page’s job.
- The route that lists or approves. Authority has no HTTP surface. Protect yours.
- Argument size. Arguments are stored as JSON; cap what your tools accept before they reach the gate if the model could produce very large payloads.
- Secrets in arguments. Do not pass secrets as tool arguments; they would be stored with the action and the decision.
Parameterised SQL
All values are bound parameters; identifiers are constants in the source. JSON is sent as text and cast in SQL. A static test fails the build if a SQL template interpolates anything but the two constant column lists, or if a statement does not filter on the tenant.
Append-only decisions
sql/authority.sql installs a trigger that raises on UPDATE and DELETE of authority_decisions.
A correction is a new row. If you need retention limits, partition or archive by created_at
with a role that bypasses the trigger; the library never does.
Supply chain
The package has no runtime dependencies. Drivers (pg, postgres, @neondatabase/serverless)
are optional peers you install yourself. CI runs typecheck, lint, build and the tests on Node 20
and 22 against Postgres 16.