Security
Threat Model
The assets AgentShield protects, the adversaries it considers, the threats it mitigates, and the assumptions it relies on.
This threat model describes the system as built in this repository. Each mitigation names the mechanism that implements it.
Assets
| Asset | Why it matters |
|---|---|
| Side effects of tool calls | Refunds, emails, record changes, outbound requests |
| Tool credentials | API tokens for systems behind adapters |
| Agent seeds | Anyone holding one can sign as that agent |
| Policy documents | Define what every agent may do |
| Approval decisions | Release held actions |
| Audit trail and evidence | The record of what happened, used for investigation and accountability |
| Tenant isolation | One organization's agents, data, and events must stay invisible to another |
Adversaries
| Adversary | Capability |
|---|---|
| Content attacker | Controls text an agent reads: web pages, tickets, API responses, retrieved memory. Cannot call AgentShield directly |
| Compromised agent | Controls the agent process, including its seed and the requests it signs |
| Network attacker | Observes or modifies traffic between agent and gateway; may capture and replay requests |
| Malicious or careless insider | Has a control plane account with some role |
| Other tenant | Has legitimate access to a different organization |
| Infrastructure attacker | Gains access to the database, object store, or host |
Threats and mitigations
| Threat | Mitigation | Residual risk |
|---|---|---|
| Injected content makes the agent call a dangerous tool | Policy decides from stored documents; default deny; deny precedence; approvals for sensitive actions | The agent can still misuse allowed actions within its budget |
| Injected content makes the agent change a URL or arguments | Fixed resources per tool; exact resource rules; arguments bound by hash at execute | A tool without a fixed resource accepts any resource policy allows |
| Agent exfiltrates tool credentials | Credentials live in the gateway and are injected per host; agents cannot set Authorization, cookies, or Host | Data the tool returns is visible to the agent |
| Agent reaches internal services (SSRF) | Host allow-list; post-DNS address checks; no redirects; proxy variables ignored; network policy repeats the checks | An allow-listed host is trusted to be what it claims |
| Stolen or captured request is replayed | Nonce reserved for 130 s; 60 s timestamp window; signature over the body | A Redis data loss reopens replay within the 60 s window |
| Request modified in transit | Signature over SHA-256 of the raw body | — |
| Agent claims another organization or prior approval | Body claims ignored as authority; mismatches are denied | — |
| Agent approves its own action | Agents cannot reach the control plane; approver id must differ from agent id; only the gateway creates approval rows | — |
| Approval reused for a different call | Approval bound to raw-body hash and decision; consumed once | — |
| Retried execution repeats a side effect | Claim before dispatch; failed or interrupted executions refused | Availability: a retry needs a new authorization |
| Runaway agent loops | Per-agent request, tool, and token budgets; circuit breaker | Damage within the budget window |
| Compromised agent seed | Rotate, suspend, or revoke; every call is attributed and audited | Calls made before detection succeed if policy allowed them |
| Insider edits policy to grant access | Owner/admin only; immutable versions; every decision records the version used | Authorized admins can change policy |
| Insider quietly deletes audit records | Append-only triggers; hash chain; external head exports | A schema owner can disable triggers; detection relies on exported heads |
| Cross-tenant access | Organization from authenticated principal; composite foreign keys; RLS for the app role | The schema owner bypasses RLS |
| Evidence tampering | SHA-256 recorded in PostgreSQL; verified on every read; reads audited | Deletion is not prevented without object lock or versioning |
| Analyzer used to block service | Findings are advisory; analysis fails open with a short timeout | — |
| Metrics leak tenant activity | No tenant labels; fixed label sets; separate metrics ports | Platform totals are visible to the monitoring system |
Assumptions
AgentShield's guarantees rely on these conditions. Violating one weakens the corresponding control.
- The gateway host is trusted. It holds tool credentials and database access.
- The database owner is trusted or external audit head exports are kept somewhere it cannot write.
- Production uses
agentshield_app. The owner role bypasses row level security. - Clocks are synchronized within the 60-second window.
- Redis is available and durable enough for the 130-second nonce window.
- TLS terminates in front of the gateway and control plane in any non-loopback deployment.
- Agent seeds are stored as secrets by agent operators.
- Metrics ports are reachable only from monitoring. They are unauthenticated by design.
- The network plugin enforces NetworkPolicy on Kubernetes.
Out of scope
- Stopping prompt injection inside the model.
- Proving content is safe.
- Defending a compromised gateway host.
- Tamper-proof logging against an adversary who controls the database and every external copy of the head.
- Dependency and image vulnerability scanning in this repository's CI.
Was this page helpful?