learning-it by example

Back to the video

OWASP Top 10 for LLM Apps: Three Risks Tested in Code

A planted page reached the top three results for four of five questions, and a filter missed two leaks.

Video #93 ยท AI security and governance

Steps in the video

  1. 0:00 Ten risks, three of them tested
  2. 0:28 The ten
  3. 1:08 Setup
  4. 1:38 Eight: a planted page
  5. 2:06 Two: a filter on the replies
  6. 2:36 Ten: one user floods the service
  7. 3:48 What this does not show
  8. 4:11 Mistakes to avoid
  9. 4:38 My take and next steps
  10. 5:05 Recap

Files

  • budget.py (15 lines)
  • compare.py (18 lines)
  • leaks.py (19 lines)
  • poisoned.py (39 lines)

Download the code (zip)

Tested with

Python 3.12.15 | ollama==0.6.3

What this does not show

Three of the ten risks, with small made-up examples. The first test only ranks pages with one small embedding model (all-minilm); no prompt is built and no model answers. The filter has three patterns. The token counts for the flood are made up. A source check only helps if the source label cannot be faked.

Sources

Learning IT by Example.