Authentication and Authorization
A security analysis of how AgentShield separates identity from authority for agents and humans, and the attacks each design choice closes.
This page looks at authentication and authorization from an attacker's point of view. For the mechanics, see Authentication and Authorization.
Two principals, two planes
| Agents | Humans | |
|---|---|---|
| Plane | Gateway (/api/v1/runtime/*) | Control plane (/api/v1/*) |
| Credential | Ed25519 key, per-request signature | Bearer session, 12 hours |
| Stored server-side | Public key and fingerprint | SHA-256 of the token; Argon2id password |
| Cross-plane use | Refused by the control plane | Refused by the gateway |
Keeping the planes separate means compromising one credential type never grants the other plane's capabilities. A leaked agent seed cannot approve anything. A leaked admin session cannot sign tool calls.
Attacks on agent authentication
| Attack | Why it fails |
|---|---|
| Forge a request for another agent | Requires that agent's private key |
| Modify arguments of a captured request | The signature covers the SHA-256 of the raw body |
| Replay a captured request | Nonce reused within 130 s is rejected; older timestamps are outside the 60 s window |
| Enumerate agent ids | Unknown ids and bad signatures return the same 401 authentication failed |
| Use a suspended or revoked agent | Authenticated, then denied and recorded with the status as reason |
| Present a human session to the gateway | 401 before any other processing |
Attacks on human authentication
| Attack | Mitigation |
|---|---|
| Steal a session token from the database | Only SHA-256 hashes are stored |
| Brute-force passwords offline | Argon2id hashes; 12-character minimum |
| Use a session after sign-out or disable | Sessions are revoked server-side on sign-out, password change, and disable |
| Abuse a temporary password | Its session can only read itself, sign out, and change the password |
| Steal an invitation link from logs | Token in the URL fragment, never sent to servers; SHA-256 stored; single use; 72-hour expiry |
| Probe invitation tokens | Every unknown, used, or expired token gets the same 404 |
| CSRF against the console | SameSite=Strict cookie; writes require a same-origin Origin or Sec-Fetch-Site: same-origin |
| Steal the bearer token in the browser | The dashboard never exposes it to client JavaScript; it lives in an HttpOnly cookie |
Authorization: claims versus authority
The most important authorization rule in AgentShield is that nothing in an agent's request body grants anything:
{
"agent_id": "…", // must equal the signer, else deny
"organization_id": "…", // claim, compared with the stored agent, else deny
"operation": "payment.refund", // the subject of evaluation, not a permission
"arguments": { "approved": true } // just data; ignored by authorization
}Authority comes only from:
- the key that verified the signature,
- the agent and organization rows loaded for that key, and
- the active policy versions for that organization and agent.
Authorization precedence as a security property
ADR 0004 fixes precedence as deny → approval → allow → default deny across both documents. This matters because:
- An organization-wide deny cannot be overridden by a permissive agent policy, so a mistake in one agent's policy is contained.
- An attacker with write access to only an agent policy cannot hide a grant for a globally denied action.
- Document order is not a security property. Reordering a list never changes a decision.
Role separation for humans
| Role | Intended use |
|---|---|
owner | Full administration, including granting the owner role |
admin | Administration except the owner role |
operator | Registering agents and watching activity |
auditor | Read-only access to audit, incidents, alerts, and evidence |
approver | Deciding held actions only |
Nobody can change their own role or status. Only an owner can grant or change the owner role, and each organization keeps at least one active owner. The member rules are a pure function with unit tests, and owner rows are locked while they are checked.
Failure semantics
Every authorization error is a deny or an error response, never an allow:
| Failure | Result |
|---|---|
| Policy load error | Recorded deny: policy load failed |
| Invalid stored document | Recorded deny: policy evaluation failed |
| Database write error | 500 internal_error; transaction rolled back; nothing executes |
| Unknown outcome value from storage | Rejected by ParseOutcome; treated as an error |
Implementation references
Was this page helpful?