Lion Cipher Lab
Turn prompt-injection attempts into a promptfoo test suite that runs on every change
- AI Security
- Intermediate
- ~50 min
- Free · no account required
Why it matters
Teams red-team an LLM feature once, fix what they find, and move on. Then someone tweaks the prompt, swaps the model for a cheaper one or adds a feature, and the old hole quietly reopens. Security findings only stay fixed when they become tests that run on every change, which is how ordinary software has worked for decades. promptfoo is a widely used open-source tool for testing LLM apps: you describe the prompt, the model and the test cases in one file, and it tells you which cases fail. In this lab the app has one job and one secret, a discount code it must never reveal, and you turn a…
What you'll learn
- describing an LLM app under test as a promptfoo config: prompt, provider, tests
- writing deterministic assertions (not-icontains, regex) for a secret that must never leak
- running a local model through promptfoo with Ollama, offline and free
- using --repeat to expose flaky, sometimes-leaking behaviour
- comparing a hardened prompt against the original with evidence, not impressions
- explaining why keeping secrets out of the prompt beats prompt hardening
Steps in this lab
- The idea: a finding is only fixed if a test keeps it fixed
- Get a free local model running
- Write the app under test: a support bot with a secret
- Write the suite: one normal question and six attacks
- Run it and read the matrix
- Catch the leak that only happens sometimes
- Try the obvious fix, and measure it
- Make it part of every change, and know its limits
Open the full interactive lab →