|
1 | | -# Contributing to MCP Security Summit Workshop |
| 1 | +# Contributing |
2 | 2 |
|
3 | | -Thank you for your interest in improving this workshop! This guide explains the repository structure and how to contribute effectively. |
| 3 | +Thank you for your interest in improving this workshop! |
4 | 4 |
|
5 | | -## Repository Structure |
6 | | - |
7 | | -``` |
8 | | -/ |
9 | | -├── camps/ # Workshop modules (Base Camp → Summit) |
10 | | -│ ├── base-camp/ # Fundamentals + basic authentication |
11 | | -│ ├── camp1-identity/ # OAuth, Managed Identity, Key Vault |
12 | | -│ ├── camp2-gateway/ # API/MCP Gateway, Network Security |
13 | | -│ ├── camp3-io-security/ # Content Safety, Input Validation |
14 | | -│ └── camp4-monitoring/ # Logging, Monitoring, Alerts |
15 | | -├── infra/ # Shared Bicep templates |
16 | | -│ ├── shared/ # Common Azure resources |
17 | | -│ └── README.md |
18 | | -├── scripts/ # Deployment automation helpers |
19 | | -│ └── README.md |
20 | | -├── docs/ # GitHub Pages documentation |
21 | | -│ └── index.md |
22 | | -└── README.md # Workshop overview |
23 | | -``` |
24 | | - |
25 | | -## How to Add a New Camp |
| 5 | +## Quick Links |
26 | 6 |
|
27 | | -Each camp follows the **vulnerable → secure** pattern established in Base Camp. Use this template: |
| 7 | +- **📚 Workshop:** [azure-samples.github.io/sherpa](https://azure-samples.github.io/sherpa/) |
| 8 | +- **🔒 Security Guide:** [microsoft.github.io/mcp-azure-security-guide](https://microsoft.github.io/mcp-azure-security-guide/) |
28 | 9 |
|
29 | | -### Camp Directory Structure |
| 10 | +## Repository Structure |
30 | 11 |
|
31 | 12 | ``` |
32 | | -camps/your-camp/ |
33 | | -├── README.md # Participant guide (5-phase format) |
34 | | -├── pyproject.toml # Dependencies (managed by uv) |
35 | | -├── vulnerable-server/ # Insecure implementation |
36 | | -│ ├── src/ |
37 | | -│ │ ├── server.py # MCP server with vulnerabilities |
38 | | -│ │ └── ... |
39 | | -│ ├── pyproject.toml # Package metadata |
40 | | -│ ├── Dockerfile |
41 | | -│ └── .env.example |
42 | | -├── secure-server/ # Fixed implementation |
43 | | -│ ├── src/ |
44 | | -│ │ ├── server.py # MCP server with security controls |
45 | | -│ │ └── ... |
46 | | -│ ├── pyproject.toml # Package metadata |
47 | | -│ ├── Dockerfile |
48 | | -│ └── .env.example |
49 | | -├── exploits/ # Demonstration scripts |
50 | | -│ └── test_exploit.py |
51 | | -├── infra/ # Camp-specific Bicep |
52 | | -│ └── main.bicep |
53 | | -└── vscode-config/ # Example MCP client configs |
54 | | - └── mcp-settings.json |
| 13 | +sherpa/ |
| 14 | +├── camps/ # Workshop modules |
| 15 | +│ ├── base-camp/ # Local-only, MCP fundamentals |
| 16 | +│ ├── camp1-identity/ # Azure: OAuth, Managed Identity |
| 17 | +│ ├── camp2-gateway/ # Azure: APIM, Content Safety |
| 18 | +│ ├── camp3-io-security/ # Azure: Input validation, PII |
| 19 | +│ └── camp4-monitoring/ # Azure: Logging, alerts |
| 20 | +├── docs/ # MkDocs documentation |
| 21 | +│ └── camps/ # Workshop guides |
| 22 | +└── mkdocs.yml |
55 | 23 | ``` |
56 | 24 |
|
57 | | -**Note:** Camps use `uv` for fast, reliable dependency management. Run `uv sync` in the camp root to set up the environment. |
58 | | - |
59 | | -### Camp README.md Format |
60 | | - |
61 | | -```markdown |
62 | | -# Camp [N]: [Theme Name] |
63 | | - |
64 | | -*"[Mountain metaphor subtitle]"* |
65 | | - |
66 | | -**Duration:** [X] minutes |
67 | | -**OWASP Risks:** [MCP0X, MCP0Y] |
68 | | -**Azure Services:** [Service A, Service B] |
69 | | -**Guide Reference:** [Link to microsoft.github.io/mcp-azure-security-guide] |
| 25 | +## Workshop Pattern |
70 | 26 |
|
71 | | -## Learning Objectives |
72 | | -- Objective 1 |
73 | | -- Objective 2 |
| 27 | +All camps follow **exploit → fix → validate**: |
74 | 28 |
|
75 | | -## Route Map |
76 | | -| Phase | Activity | Duration | Type | |
77 | | -|:-----:|----------|:--------:|:----:| |
78 | | -| **1** | Deploy Vulnerable System | [X] min | Setup | |
79 | | -| **2** | Exploit Vulnerabilities | [X] min | Hands-on | |
80 | | -| **3** | Implement Security Fixes | [X] min | Hands-on | |
81 | | -| **4** | Validate Fixes | [X] min | Verification | |
82 | | -| **5** | Summary & Teaching Points | [X] min | Discussion | |
| 29 | +1. Start with a vulnerable or incomplete configuration |
| 30 | +2. Demonstrate the security risk |
| 31 | +3. Apply the fix |
| 32 | +4. Validate the fix works |
83 | 33 |
|
84 | | -[... detailed phase instructions ...] |
85 | | -``` |
86 | | - |
87 | | -## Code Style Guidelines |
| 34 | +## Camp Types |
88 | 35 |
|
89 | | -### Python MCP Servers |
| 36 | +| Type | Example | Deployment | Key Files | |
| 37 | +|------|---------|------------|-----------| |
| 38 | +| **Local** | Base Camp | `uv run python -m src.server` | `vulnerable-server/`, `secure-server/` | |
| 39 | +| **Azure** | Camps 1-4 | `azd up` | `azure.yaml`, `infra/`, `scripts/` | |
90 | 40 |
|
91 | | -- Use the official `mcp` Python package (not FastMCP) |
92 | | -- Python 3.10+ with type hints |
93 | | -- Clear comments explaining vulnerabilities and fixes |
94 | | -- Follow PEP 8 style guidelines |
| 41 | +## Running Docs Locally |
95 | 42 |
|
96 | | -**Example vulnerability comment:** |
97 | | -```python |
98 | | -# VULNERABILITY: No authentication check! |
99 | | -# This allows ANY client to access ANY user's data. |
100 | | -# Maps to OWASP MCP07: Insufficient Authentication |
101 | | -@server.list_resources() |
102 | | -async def list_resources() -> list[Resource]: |
103 | | - # Should check authentication here but doesn't |
104 | | - return [Resource(...)] |
| 43 | +```bash |
| 44 | +pip install -r requirements-docs.txt |
| 45 | +mkdocs serve |
105 | 46 | ``` |
106 | 47 |
|
107 | | -**Example security fix comment:** |
108 | | -```python |
109 | | -# SECURITY FIX: Validate authentication on every request |
110 | | -# This addresses OWASP MCP07 by ensuring only authorized |
111 | | -# clients can access resources. |
112 | | -def require_auth(func): |
113 | | - async def wrapper(*args, **kwargs): |
114 | | - token = get_token_from_context() |
115 | | - if not validate_token(token): |
116 | | - raise PermissionError("Unauthorized") |
117 | | - return await func(*args, **kwargs) |
118 | | - return wrapper |
119 | | -``` |
120 | | - |
121 | | -### Bicep Templates |
122 | | - |
123 | | -- Use consistent naming conventions: `{resource-type}-{camp-name}` |
124 | | -- Include comments explaining security controls |
125 | | -- Output important values (endpoints, resource IDs) |
126 | | -- Follow Azure naming best practices |
127 | | - |
128 | | -### Documentation |
129 | | - |
130 | | -- Use clear, action-oriented headings |
131 | | -- Include code snippets with explanations |
132 | | -- Provide expected outputs for validation steps |
133 | | -- Link to relevant OWASP MCP Top 10 sections |
134 | | -- Use callout boxes for important notes |
135 | | - |
136 | | -## Testing Your Contribution |
137 | | - |
138 | | -Before submitting a pull request: |
139 | | - |
140 | | -1. **Set up the environment:** |
141 | | - ```bash |
142 | | - cd camps/your-camp |
143 | | - uv sync # Install dependencies |
144 | | - ``` |
| 48 | +## Code Guidelines |
145 | 49 |
|
146 | | -2. **Test the vulnerable version:** |
147 | | - - Deploy and run the vulnerable server |
148 | | - - Verify the exploit works as documented |
149 | | - - Ensure the vulnerability is clear to participants |
| 50 | +- **Python:** 3.11+, type hints, `uv` for dependencies |
| 51 | +- **Bicep:** Consistent naming, security comments |
| 52 | +- **Scripts:** Bash, `set -e`, clear progress output |
150 | 53 |
|
151 | | -3. **Test the secure version:** |
152 | | - - Deploy and run the secure server |
153 | | - - Verify the exploit now fails appropriately |
154 | | - - Ensure security controls work as documented |
| 54 | +## Testing Changes |
155 | 55 |
|
156 | | -4. **Validate documentation:** |
157 | | - - Follow your own instructions step-by-step |
158 | | - - Verify all commands work |
159 | | - - Check all links are valid |
| 56 | +1. Run through the workshop guide yourself |
| 57 | +2. Verify exploit scripts demonstrate the vulnerability |
| 58 | +3. Verify fix scripts resolve the issue |
| 59 | +4. Check documentation renders correctly |
160 | 60 |
|
161 | | -## Submission Guidelines |
| 61 | +## Submitting Changes |
162 | 62 |
|
163 | | -1. Fork the repository |
164 | | -2. Create a feature branch: `git checkout -b camp-feature-name` |
165 | | -3. Make your changes following the guidelines above |
166 | | -4. Test thoroughly (see Testing section) |
167 | | -5. Commit with clear messages: `git commit -m "Add Camp X: [Feature]"` |
168 | | -6. Push to your fork: `git push origin camp-feature-name` |
169 | | -7. Open a Pull Request with: |
170 | | - - Clear description of what was added/changed |
171 | | - - Which OWASP MCP risks are addressed |
172 | | - - Testing steps you performed |
| 63 | +1. Fork and create a branch |
| 64 | +2. Make changes and test thoroughly |
| 65 | +3. Submit a Pull Request with a clear description |
173 | 66 |
|
174 | 67 | ## Questions? |
175 | 68 |
|
176 | | -Open an issue or discussion in the repository. We're here to help! |
| 69 | +Open an [issue](https://github.com/Azure-Samples/sherpa/issues). |
177 | 70 |
|
178 | 71 | --- |
179 | 72 |
|
180 | | -*Thank you for helping others scale the summit safely! 🏔️* |
| 73 | +*Thank you for helping others reach the summit safely! 🏔️* |
0 commit comments