Capstone: Review a Secure Agent and MCP Design
Table of Contents
Return to the Secure AI Agents and MCP Course
Your capstone is a security decision package for Patch Clerk. Another reviewer should reach the same deployment decision from your artifacts and evidence.
Scenario Change
Patch Clerk now reads synthetic issues, reads repository files, proposes a patch, and applies a reviewed patch in a test repository. A product owner requests a new post_comment tool. The tool would publish text to a fictional issue system.
Your job is to decide whether post_comment enters the first release. Treat publication as an external side effect.
Required Package
Create capstone/ with these files:
capstone/
system-map.md
authority-matrix.md
mcp-security-contract.md
event-example.json
detection-plan.md
attack-test.md
deployment-decision.md
Each file has one purpose:
system-map.mdnames components, trust boundaries, data origins, and owners.authority-matrix.mdlists operations, identities, approval, and evidence.mcp-security-contract.mddefines inputs, outputs, limits, errors, and side effects.event-example.jsonshows the decision event format without storing unnecessary raw content.detection-plan.mdmaps signals to stop and recovery actions.attack-test.mdrecords the hostile fixture, expected result, observed result, and retest.deployment-decision.mdstates approve, approve with conditions, or reject.
Build the Review
- Copy your lesson artifacts into
capstone/. - Add
post_commentto the authority matrix as proposed. - Define a 2,000-character limit and one approved issue target.
- Require a preview and trusted host-held, single-use approval bound to the comment digest and target-state precondition. A caller-supplied digest is not approval.
- Give the tool a dedicated identity restricted to comment creation on the approved test project.
- Add rate limits and a stop rule for repeated publication requests.
- Run the
local comment policy simulator
with
python3 comment_policy_lab.py. Record all nine expected and observed decisions inattack-test.md. Include the hostile denial, validwould_postdecision, replay denial, forged self-approval denial, target and length denials, identity denial, changed-state denial, and rate-limit denial. - Record your decision and residual risks.
Do not connect a live issue service. Treat the capstone as a design and local policy test.
Decision Rubric
| Area | 0 points | 1 point | 2 points |
|---|---|---|---|
| Authority | Broad shared identity | Narrow identity with gaps | Dedicated least-privilege identity |
| Input | Free-form unchecked payload | Length or target check | Typed input, target allowlist, and length limit |
| Approval | None | Approval before final payload | Preview and digest-bound single-use approval |
| Evidence | Model transcript only | Host event | Host, server, and downstream correlation |
| Attack test | No hostile fixture | Expected result only | Observed local denial plus positive test |
| Recovery | Restart only | Revoke or restore | Stop, revoke, preserve, restore, repair, retest |
A score below 10 out of 12 fails the release review. Any zero in authority, approval, or attack test also fails.
Reference Answer
The reference decision is approve with conditions for a test environment.
Required conditions:
post_commentuses a dedicated test-project identity.- The host shows issue identifier and final comment text.
- A trusted host records approval with a random, single-use token bound to the action digest and expiry. Untrusted content cannot mint approval.
- The server rejects any other project, issue, or payload over 2,000 characters. Approval binds the preview and current target-state digest.
- The event stream records preview, approval, call, and downstream result under one run ID.
- A hostile issue instruction fails before the downstream request.
- A valid approved comment returns
would_postin the synthetic positive test. The local simulator prints9/9 passedand makes no downstream request.
Production release stays out of scope until a real authorization test, downstream audit review, and incident exercise produce evidence.
Expected Result
Your package scores at least 10. It contains no real secrets or external connections. The decision states who owns remaining risk and which evidence is still missing for production.
Troubleshooting
- The package repeats chat transcripts: Replace narrative with maps, contracts, events, diffs, and test results.
- The comment identity reaches every project: Restrict the downstream account before relying on server input checks.
- Approval lacks a payload digest: Bind approval to the final issue target and comment text.
- The attack test blocks valid comments: Add a positive test and repair the narrow policy path.
- Residual risk has no owner: Assign a named role with a review date and acceptance decision.
Verify Completion
find capstone -maxdepth 1 -type f -print | sort
python3 -m json.tool capstone/event-example.json
grep -Ein "decision|owner|residual|approval|digest" capstone/deployment-decision.md
Pass when all seven files exist, JSON parses, the rubric score reaches ten, no core area scores zero, and the decision separates observed local evidence from future production tests.
Return to the course hub or review the MCP 2026-07-28 release notes before adapting the package to a real implementation.


