learning-it by example

Back to the video

Secrets in ML Apps: Scan, Move Out, Rotate (Python)

I planted 5 made-up secrets in a made-up ML app; a two-rule scanner found 4, missed 1 and raised 1 false alarm.

Video #163 ยท MLOps and deployment

Steps in the video

  1. 0:00 5 made-up secrets planted: my scanner found 4, missed 1, and raised 1 false alarm
  2. 0:29 The idea
  3. 0:50 Setup
  4. 1:09 The made-up app
  5. 1:35 A notebook and the history
  6. 1:56 Two rules
  7. 2:25 Score the scanner
  8. 3:00 Keep values out of the code
  9. 3:19 Where the values come from
  10. 3:51 Clean the notebook
  11. 4:27 Rotate, with narrow scopes
  12. 5:15 What this does not show
  13. 5:40 Mistakes to avoid
  14. 6:10 My take and next steps
  15. 6:26 Recap

Files

  • fixed.py (32 lines)
  • planted.py (37 lines)
  • provider.py (30 lines)
  • run.py (60 lines)
  • scan.py (19 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

A made-up app with made-up keys built at run time; a two-rule scanner tuned to those keys (no real scanner is run); a text file stands in for git history and a dictionary for the key service; no secret manager is used.

Sources

Learning IT by Example.