Security
Security Best Practices
A practical checklist for designing policies, deploying services, integrating agents, and operating AgentShield securely.
AgentShield's defaults fail closed, but the strength of a deployment depends on how it is configured and operated. Use this page as a checklist.
Policy design
- Start from deny. Allow only the operations each agent needs. Unlisted actions are denied automatically.
- Use the organization policy for guardrails. Put actions no agent should ever perform, such as
database.exportorhttp.delete, in the organization'sdeniedlist. Agent policies cannot override it. - Separate reads from writes. Give them different operations (
http.getversushttp.post) so policy can allow one and hold the other. - Hold irreversible actions for approval. Payments, outbound email, deletes, and external writes belong in
approval_required. - Pin sensitive resources. Use
allowresource rules to turn an action into an exact allow-list of resources. - Review policy diffs. Every change creates an immutable version; review them like code.
Agent integration
- One agent per permission set. Register separate agents for workloads that need different permissions.
- Protect seeds. Store them in a secret manager or a file readable only by the agent's account; never log them.
- Never add a local fallback. Do not run a tool locally when the gateway denies it. That recreates the bypass AgentShield removes.
- Fix resources in tool specs where the model should not choose the target.
- Pass warnings to the model. Keep the
warningfield with flagged content so the model treats it as data. - Describe tools precisely. Narrow, well-described tools reduce the chance a model reaches for the wrong one.
- Keep clocks synchronized within 60 seconds.
Tool configuration
- List only hosts you trust. An allowed host that proxies arbitrary URLs becomes an SSRF path.
- Inject credentials from the gateway. Use tools-file
headerswith environment variables; never pass API keys through agent arguments. - Scope tool credentials narrowly at their issuer: read-only tokens for read tools.
- Never enable
allow_insecure_httporallow_private_networksoutside development. Production refuses them. - Keep response limits small enough for your use case.
Deployment
- Run with
AGENTSHIELD_ENV=production. It enforces the app database role, analyzer token, TLS for NATS and object storage, and secure mail settings. - Connect services as
agentshield_app. Only the bootstrap job should use the schema owner. - Terminate TLS in front of the gateway and the control plane.
- Keep metrics ports private. They are unauthenticated; restrict them to your monitoring network.
- Use a network plugin that enforces NetworkPolicy on Kubernetes.
- Verify image signatures with cosign before deploying, and consider admission-time enforcement.
- Pin images by digest in the production overlay.
- Enable object lock or versioning on the evidence bucket if deletion is in your threat model.
- Give Redis appropriate durability for the nonce window.
Operations
- Export the audit head regularly and copy it somewhere the database owner cannot write.
- Watch the alert rules: circuit open, analyzer unavailable, injection spikes, outbox lag, evidence failures. Add an Alertmanager to page someone.
- Triage alerts and incidents.
deny_burstincidents andcontent.flaggedalerts often indicate a steered agent. - Assign roles minimally. Use
approverfor people who only decide held actions, andauditorfor read-only review. - Rotate agent keys on a schedule and immediately after suspected exposure.
- Suspend first, investigate second when an agent behaves unexpectedly.
- Run chaos scenarios after changes to confirm defensive properties still hold.
Incident response quick reference
| Signal | First action |
|---|---|
| Seed exposed | Rotate the agent credential |
| Agent behaving oddly | Suspend the agent |
| Secret finding (EX rules) | Rotate the leaked secret at its issuer |
| Injection finding (PI rules) | Review the source content and the agent's subsequent calls |
| Evidence integrity failure | Treat the object store as compromised; preserve the database record |
| Audit chain mismatch with an export | Treat the database as compromised; restore from backup and investigate |
Was this page helpful?