AI security: secure and test LLM apps and agents

Stage 1 · Lesson 4 of 7

Secrets: keys, tokens and where they live

Security foundations for AI builders

A secret is anything that grants access: model , database passwords, , signing keys. AI projects leak secrets in familiar and new ways. Familiar: keys committed to Git, pasted into notebooks or printed in logs.

New: keys placed in a or a tool description, where the model can repeat them, and keys sitting in the environment of a machine where an agent runs generated code. Keep secrets in a secrets manager or environment variables on the server only, give each one the smallest scope and a spending limit where the provider allows, rotate them, and scan your repositories with a tool such as .

Common trapbelieving a secret is safe in a system prompt because users cannot see the prompt; this roadmap assumes every prompt can leak.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

  • Free labs on injection, XSS, access control and SSRF, the weaknesses AI apps inherit

  • A deliberately vulnerable web app to run locally and practise finding and fixing classic bugs

Keep handy

  • Short, reliable guides on threat modelling, secrets, output encoding and SSRF prevention

  • Scan your repositories for committed keys before you build anything with a model API

Also worth your time

Mark this stage as not done?