Instead of writing a token into a config file, write a reference and let a tool resolve it when the process starts. 1Password secret references with op run and Vault Agent templates are common ways to keep plaintext out of files an agent can read. The running process still sees the value, so pair this with egress limits.
Read in this order
- Official1Password CLI: Use secret referencesStart here: how to put a reference in config and keep the token out.
- Official1Password CLI: op runInject secrets into a process only at launch with op run.
- OfficialHashiCorp Vault: What is Vault Agent?The Vault route: an agent that fetches and templates secrets for your process.