Agents Playbook
Pillars/Security

Pillar — Security

How to build security in from day one when the people writing the code are agents, not a hardened security team.

Pillar — Security

How to build security in from day one when the people writing the code are agents, not a hardened security team.

Status

◐ Scoped, not yet detailed. Universal layer outlined below; concrete recipes ship in a future session.

Scope

ConcernUniversal principleConcrete pattern (TS)
IdentityOne signed principal per call; never trust caller-supplied userIdresolveAuthContext(req) middleware; principal comes from verified session/JWT only
RBACRoles → capabilities → resources, persisted, auditedRBAC store with SQLite; capability check at handler entry
VaultSecrets sealed at rest, sealer is rotatableKey ring with KMS/HSM sealer; envelope-encrypted secrets
Audit ledgerAppend-only, signed batches, Merkle-verifiableEd25519-signed audit entries; periodic Merkle anchoring
EgressAllowlist outbound network access per workspacefirewall.evaluate(url, ctx) at every fetch; deny by default
Consent vs elevationScoped time-boxed user consent ≠ role escalationconsent.grant (scoped) and access.breakGlass (role-elevation) are separate contracts
PIIClassification → redaction → retentionPII profiles + redaction at log + storage boundaries
Legal holdSuspend retention on subject of investigationLegal-hold flag short-circuits retention GC
DSARSubject access / deletion request workflowDSAR proof-of-completion record signed
Key rotationConnector creds + sealer keys rotatable without downtimeVersioned keys, dual-write window, audit on rotate
Break-glassTime-boxed admin elevation with signed auditaccess.breakGlass.{request,list,revoke} writes signed ledger
Threat modelDocumented and revisited per releasedocs/security/threat-model.md, updated on RFC changes

Non-negotiables

  1. No raw secrets in code, env files committed, or logs. Vault refs only; logs redact known PII keys at the logger.
  2. Auth defaults to required. Every contract entry is requireAuth: true unless an explicit false survives PR review.
  3. Audit before action. Privileged operations log to the signed ledger before they execute; rollback if they fail.
  4. Egress is allowlist, not blocklist. Default deny.
  5. Tenancy from the session, never the body. orgId / workspaceId is resolved from the verified principal; clients cannot spoof it.

See also

Documents in this pillar

DocRead when
universal.mdFirst read; the 10 non-negotiables
rbac-pattern.mdDesigning role / capability / scope model
vault-pattern.mdStoring secrets; rotation; sealer
audit-ledger-pattern.mdAppend-only signed ledger for privileged actions
egress-firewall-pattern.mdOutbound network allowlist
vulnerability-mgmt-pattern.mdSBOM, CVE triage, supply-chain attacks, signed releases
dependency-hygiene-pattern.mdAdd / update / remove dependency lifecycle, transitive risk
multi-tenant-isolation-pattern.mdTenant data isolation, noisy-neighbor, cell-based deploy
data-classification-pattern.mdPer-field tagging drives redaction, retention, residency
on-call-rotation-pattern.mdPaging structure, severity ladder, IMOC, post-mortems
secrets-leak-postmortem-playbook.mdMinute-by-minute response when a secret leaks
compliance-framework-pattern.mdSOC 2 / ISO / GDPR / HIPAA controls mapped to playbook practices
secrets-mgmt-deep-pattern.mdDynamic secrets; OIDC federation; workload identity; secret-zero
session-mgmt-pattern.mdHybrid JWT + refresh; cookie flags; step-up; SSO + SCIM
rate-limiting-ddos-pattern.mdEdge + app rate limits; algorithms; login + signup hardening
container-k8s-security-pattern.mdImage hygiene; SecurityContext; NetworkPolicy; admission control
ai-llm-safety-pattern.mdPrompt injection defense; tool authorization; cost + safety caps
threat-model-template.mdPer-project threat-model skeleton