You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
Security Runbook
Security model
The service supports three auth modes via AUTH_MODE:
api_key: static shared secret (AGENT_API_KEY)jwt: bearer JWT with scope checkshybrid: API key accepted first, then JWT fallback
The same backend is used across:
- REST API
- A2A adapter
- MCP tools
MCP can override auth mode independently with MCP_AUTH_MODE:
inherit(default): useAUTH_MODEapi_key|jwt|hybrid|oauth: MCP-only override
Recommended deployment posture
External traffic:
- Use
AUTH_MODE=jwt - Require HTTPS at reverse proxy/gateway
- Restrict exposed routes to required protocol endpoints
- For MCP connectors,
MCP_AUTH_MODE=oauthis recommended
Internal traffic:
AUTH_MODE=hybridis acceptable during migration- Prefer mTLS/private network for service-to-service traffic
Scope matrix
availability:read: availability accessmail:scan: inbox scan and triageunsubscribe:read: candidate discoveryunsubscribe:execute: unsubscribe executionunsubscribe:digest: digest scan and send
Secret and token handling
Never commit secrets:
.envtoken.json- Google OAuth client secret files
Always persist and back up:
token.jsondata/sent_unsubscribe_links.jsondata/unsubscribed_methods.json
Key and token rotation
API key rotation (api_key/hybrid)
- Generate new strong key.
- Update environment (
AGENT_API_KEY) in deployment. - Restart services.
- Update all clients.
- Remove old key from all stores.
JWT secret rotation (jwt/hybrid)
- Generate new signing secret.
- Roll out issuer/signing config first.
- Update server
AUTH_JWT_SECRET. - Restart services.
- Force token refresh for clients.
Incident response checklist
If credential leak is suspected:
- Revoke compromised key/secret immediately.
- Rotate API key and JWT secret.
- Invalidate active tokens (issuer-side).
- Review logs for unusual scans/unsubscribe operations.
- Disable mutation MCP tools (
MCP_ENABLE_MUTATION_TOOLS=false) until investigation completes. - Re-enable features after containment and verification.
Release rollout checklist
Preflight:
uv run pytest -quv run python -c "import app.main, app.mcp_main; print('import_ok')"docker compose config --services
Canary:
- Deploy to one node/environment.
- Validate:
GET /healthGET /.well-known/agent-card.json- A2A
SendMessage - MCP tool listing
- Monitor errors for 30-60 minutes.
Full rollout:
- Deploy all nodes.
- Re-run smoke checks.
- Confirm scheduler jobs continue as expected.
Rollback:
- Redeploy previous image/tag.
- Verify health and protocol smoke checks.
- Keep state files (
data/*.json) unchanged during rollback.