What is secrets exfiltration?
Secrets exfiltration is the unauthorized removal of credentials, tokens, or keys from a repo, CI log, container layer, or deleted GitHub fork. IBM 2025 average: $4.44 million.
Read guideWeb Security
How secrets leave the process, why environment variables are a weak store, and how to redact sensitive fields in logs.
Sensitive data and secrets are values that grant access or identify a person: API keys, tokens, passwords, card numbers, and government IDs. Exfiltration is the movement of those values out of the intended boundary – into a log, a ticket, a model prompt, or an attacker-controlled host. Environment variables are convenient for local development and a poor production store: they are inherited by every child process, dumped in crash reports, and visible to every library in the process. Detection and redaction belong in the request path and in the logger, not only in a post-incident search.
Start with secrets exfiltration for the threat model. Use the environment-variable guide when the store is the problem, and the log-redaction guide when the leak path is observability.
Secrets exfiltration is the unauthorized removal of credentials, tokens, or keys from a repo, CI log, container layer, or deleted GitHub fork. IBM 2025 average: $4.44 million.
Read guideAvoid environment variables for production secrets. They are plaintext, easy to dump, and have no audit trail (CWE-526). Store an ID in the env and fetch at runtime.
Read guideImplement slog.LogValuer on types that hold secrets so only allow-listed fields are logged. log/slog has been in the standard library since Go 1.21.
Read guidePII detection for AI applications finds personal data in prompts, model replies, tool calls, and logs, and acts on it in your process before it reaches a provider.
Read guide