What are environment-variable secrets?
Environment-variable secrets are API keys, passwords and tokens that a hosting platform stores and injects into an app at start-up, so the platform holds every customer's secrets in one place.
Environment-variable secrets are API keys, passwords and tokens that a hosting platform stores and injects into an app at start-up, so the platform holds every customer's secrets in one place.
Why it matters
AI agents usually reach paid models and tools through keys kept this way. If the platform is breached, an attacker can read many customers' keys at once and spend them, resell them or use them to reach data. Rotating keys after the fact is slow, because each must be revoked at the service that issued it.
Example
On 19 Oct 2026 Zeabur said an attacker read 3,218,965 environment-variable records and searched them for AI keys; on 21 Oct Railway disclosed access to customers' encrypted environment variables as part of a campaign aimed at AI providers (Zeabur, Railway).
How to defend against it
- Keep only short-lived, narrowly scoped keys in environment variables.
- Fetch long-lived keys from a secrets manager at run time, with a separate key per agent.
- Set spending caps and usage alerts at each AI provider.
- Have a tested plan to revoke every stored key in hours.
See the matching controls in the AgentSec Brief checklist.
Related terms
Credential broker; Denial of wallet; Non-human identity
Sources
From AgentSec Brief, the daily brief on securing agentic AI. Subscribe free at https://www.agentsecbrief.com