Skip to content
mentoor

Secrets and credentials around AI agents

For engineers

Keeping API keys and tokens out of the context window, brokering credentials in the tool layer, delegated OAuth and leaked-key response

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

Why is a secret in an agent's context window a risk?

Choose one answer

Check yourself · 2 of 5

Which tool signature keeps the credential away from the model?

Choose one answer

Check yourself · 3 of 5

Why should an MCP server not forward the user's incoming token to a downstream API?

Choose one answer

Check yourself · 4 of 5

A model API key was pushed to a public repo ten minutes ago. What do you do first?

Choose one answer

Check yourself · 5 of 5

Which command is the most likely to put a secret into an agent's context by accident?

Choose one answer

Topics

  1. How secrets reach the context window5 min read · .env files an agent reads, keys pasted into chat and tool output that echoes tokens, and why a secret in context can leak through logs or injection
  2. Keeping credentials outside the model5 min read · Tools that attach credentials server-side, handles instead of raw keys, and never letting the model choose or pass a token
  3. Delegated OAuth for agents acting for users6 min read · On-behalf-of flows, token exchange, audience-bound tokens and why MCP servers must not pass user tokens through
  4. Detecting and rotating leaked AI keys5 min read · Secret scanning in repos and transcripts, stolen model API keys used for compute abuse, spend alerts and a rotation runbook

Start here

Helps to know first

110 questions · last verified 2026-12