Prompts can be logged, cached, exported, or reused by downstream tools. Keep secrets outside prompt text and inject them only at execution time.
Use runtime injection with environment variables and stdin-based flows.
With sk, store once and fetch only in the process that needs the secret.
Use separate keys per environment (dev/staging/prod) and per automation surface (local agent, CI, production worker).
Redact API keys, bearer tokens, session ids, internal URLs, user identifiers, and tool outputs that could reveal secret material.
Rotate on schedule (for example monthly), rotate after role changes, and rotate immediately after suspected exposure. Revoke old keys in the same runbook.
./agent-security-checklist.md