CourseModel Context Protocol: The Complete Course · Module 8: Security · part 59 of 77
Part 59 · Module 8: Security

Lab: The defences in the repository, measured

99 min read·13 Oct 2026
Module 8 · Lab · About 75 minutes · Needs: lessons 1 to 4 of this module, and the Module 1, 5 and 6 labs (this lab rebuilds what is missing)

What you are building

stand-in fixed plan Module 6 Host PinnedHost, GuardedHost, DefendedHost: subclasses m08_gateway copy rule pinning.py rug pulls guard.py writes, env m08_lab.py matrix 10 tests no key attacks: labelled placeholders only
The lab wraps Module 6's host in subclasses and a gateway (green defences), drives it with a fixed-plan stand-in (amber), and keeps every attack a labelled placeholder (red).

Wednesday 30 September 2026, the end of the security review. The lessons stopped each attack in a notebook file of its own. This lab moves the defences into the repository: pinning.py blocks changed tools, guard.py checks writes and scopes sessions and environments, examples/m08_gateway.py holds the copy rule, and examples/m08_lab.py holds the planted notes, one stand-in and the outcome matrix, now with pinning and the restricted environment, as Lesson 4 promised. Ten tests and a commit answer Priya's question: "How do we know the fixes work?"

No step calls a model. Attacks are labelled placeholders, and the stand-in follows a fixed plan without reading note text.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.