Lesson 12.08 · Phase 12 · Safety, Security & Guardrails

Secrets and credentials

A secret the model can read is a secret an injection can print. Keep credentials out of the context entirely: the model refers to a secret by name, a broker fills in the real value only for the tool, argument and host it belongs to, and every tool result is scrubbed before the model sees it.

Learning objectives

  • Explain why a secret in the prompt, the conversation or a tool result is already leaked, whatever the model is told.
  • Build a secret broker: the model uses handles, and real values are bound to a tool, an argument and a set of hosts.
  • Scrub tool results for known secret values and credential patterns before they reach the model or the logs.
  • Give subprocesses an allow-listed environment, and choose short-lived, narrowly scoped credentials for every tool.

The quickest way to give an agent GitHub access: put the token in the system prompt. "Use this token in the Authorization header: Bearer ghp..." The model passes it to httprequest and everything works.

Loading the full lesson…