Skip to content

Commit 588105e

Browse files
committed
Security docs
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 80ac298 commit 588105e

File tree

2 files changed

+289
-0
lines changed

2 files changed

+289
-0
lines changed

docs/docs/architecture/.pages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
nav:
22
- Overview: index.md
33
- Roadmap: roadmap.md
4+
- Security Features: security-features.md
45
- Decision Records: adr
Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
# MCP Gateway Security Features
2+
3+
**⚠️ Important**: MCP Gateway is an **OPEN SOURCE PROJECT** provided "as-is" with **NO OFFICIAL SUPPORT** from IBM or its affiliates. Community contributions and best-effort maintenance are provided by project maintainers and contributors.
4+
5+
**Current Version: 0.5.0 (Beta)** - MCP Gateway is currently in early beta. Security features are continuously evolving toward the 1.0 release.
6+
7+
## Comprehensive Security Capabilities
8+
9+
### 🔐 Authentication & Identity Management
10+
11+
**JWT Token Management** - Configurable JWT tokens with expiration, per-user token catalogs, and revocation support ([#87](https://github.com/IBM/mcp-context-forge/issues/87), [#425](https://github.com/IBM/mcp-context-forge/issues/425))
12+
13+
**Database-Backed User Authentication** - Argon2id password hashing replacing basic auth ([#544](https://github.com/IBM/mcp-context-forge/issues/544))
14+
15+
**Enterprise SSO Integration** - Support for GitHub, Google, LDAP/Active Directory identity providers ([#220](https://github.com/IBM/mcp-context-forge/issues/220), [#277](https://github.com/IBM/mcp-context-forge/issues/277), [#278](https://github.com/IBM/mcp-context-forge/issues/278), [#284](https://github.com/IBM/mcp-context-forge/issues/284))
16+
17+
**Per-Virtual-Server API Keys** - Scoped access control for individual virtual servers ([#282](https://github.com/IBM/mcp-context-forge/issues/282))
18+
19+
**Enhanced Session Management** - Secure session handling for Admin UI ([#541](https://github.com/IBM/mcp-context-forge/issues/541))
20+
21+
**CSRF Token Protection** - Cross-site request forgery prevention ([#543](https://github.com/IBM/mcp-context-forge/issues/543))
22+
23+
### 🛡️ Authorization & Access Control
24+
25+
**Role-Based Access Control (RBAC)** - User/Team/Global scopes with private, team, and global catalog separation ([#283](https://github.com/IBM/mcp-context-forge/issues/283))
26+
27+
**Policy-as-Code Engine** - Rego-based policy enforcement for fine-grained authorization ([#271](https://github.com/IBM/mcp-context-forge/issues/271))
28+
29+
**IP-Based Access Control** - Configurable IP allowlisting for network-level security ([#536](https://github.com/IBM/mcp-context-forge/issues/536))
30+
31+
**Endpoint Feature Flags** - Selectively enable/disable tools, resources, prompts, servers, gateways ([#537](https://github.com/IBM/mcp-context-forge/issues/537))
32+
33+
**Resource-Level Access Control** - Virtual server composition with granular tool/resource visibility control
34+
35+
### 🔒 Data Protection & Encryption
36+
37+
**Cryptographic Request Signing** - End-to-end request/response signing and verification ([#230](https://github.com/IBM/mcp-context-forge/issues/230))
38+
39+
**TLS/mTLS Support** - Certificate-based authentication with private CA support ([#568](https://github.com/IBM/mcp-context-forge/issues/568))
40+
41+
**Enterprise Secrets Management** - HashiCorp Vault integration for secure credential storage ([#542](https://github.com/IBM/mcp-context-forge/issues/542))
42+
43+
**Transport Layer Security** - Multiple secure protocols (SSE, WebSocket, HTTPS) with configurable TLS termination
44+
45+
### 🚦 Input Validation & Sanitization
46+
47+
**Gateway-Level Input Validation** - Prevent path traversal and injection attacks ([#221](https://github.com/IBM/mcp-context-forge/issues/221))
48+
49+
**AI Guardrails & PII Masking** - Input/output sanitization with sensitive data detection ([#229](https://github.com/IBM/mcp-context-forge/issues/229))
50+
51+
**Content Size & Type Limits** - Security limits for resources and prompts ([#538](https://github.com/IBM/mcp-context-forge/issues/538))
52+
53+
**XSS Prevention** - DOMPurify integration and content sanitization ([#336](https://github.com/IBM/mcp-context-forge/issues/336), [#341](https://github.com/IBM/mcp-context-forge/issues/341), [#361](https://github.com/IBM/mcp-context-forge/issues/361))
54+
55+
**SQL Injection Prevention** - Database-level security constraints ([#342](https://github.com/IBM/mcp-context-forge/issues/342))
56+
57+
### 🛠️ Plugin & Middleware Framework
58+
59+
**Pre/Post Request Hooks** - Extensible plugin system for custom security policies ([#319](https://github.com/IBM/mcp-context-forge/issues/319))
60+
61+
**AI Middleware Integration** - Framework for adding LLM-based security capabilities ([#313](https://github.com/IBM/mcp-context-forge/issues/313))
62+
63+
**Semantic Tool Filtering** - Intelligent auto-filtering of tools based on context ([#182](https://github.com/IBM/mcp-context-forge/issues/182))
64+
65+
**Dynamic Tool Generation** - LLM-powered tool creation with security controls ([#130](https://github.com/IBM/mcp-context-forge/issues/130))
66+
67+
### 📊 Monitoring & Audit
68+
69+
**Comprehensive Audit Logging** - Database-backed audit trail for all operations ([#535](https://github.com/IBM/mcp-context-forge/issues/535))
70+
71+
**Structured JSON Logging** - Correlation IDs for request tracing ([#300](https://github.com/IBM/mcp-context-forge/issues/300))
72+
73+
**Dual Logging Support** - Console and file outputs with rotation policies ([#364](https://github.com/IBM/mcp-context-forge/issues/364))
74+
75+
**OpenTelemetry Integration** - OpenLLMetry for comprehensive observability ([#175](https://github.com/IBM/mcp-context-forge/issues/175))
76+
77+
**Prometheus Metrics** - Performance and security metrics instrumentation ([#218](https://github.com/IBM/mcp-context-forge/issues/218))
78+
79+
### 🚨 Rate Limiting & DDoS Protection
80+
81+
**Gateway-Level Rate Limiting** - Configurable request throttling per client/endpoint ([#257](https://github.com/IBM/mcp-context-forge/issues/257))
82+
83+
**Tool Execution Limits** - Resource controls and execution boundaries ([#539](https://github.com/IBM/mcp-context-forge/issues/539))
84+
85+
**Circuit Breakers** - Automatic failover for unstable backends ([#301](https://github.com/IBM/mcp-context-forge/issues/301))
86+
87+
**Smart Retry Mechanisms** - Exponential backoff with jitter ([#258](https://github.com/IBM/mcp-context-forge/issues/258), [#456](https://github.com/IBM/mcp-context-forge/issues/456))
88+
89+
### 🔍 Security Testing & Validation
90+
91+
**SAST/DAST Integration** - Semgrep and OWASP ZAP automated testing ([#259](https://github.com/IBM/mcp-context-forge/issues/259))
92+
93+
**Input Validation Test Suite** - Comprehensive security validation tests ([#552](https://github.com/IBM/mcp-context-forge/issues/552))
94+
95+
**Fuzz Testing** - Hypothesis, atheris, schemathesis, RESTler ([#256](https://github.com/IBM/mcp-context-forge/issues/256))
96+
97+
**Mutation Testing** - Test quality validation with mutmut ([#280](https://github.com/IBM/mcp-context-forge/issues/280))
98+
99+
**Security Scanners** - Bandit, grype, nodejsscan integration ([#279](https://github.com/IBM/mcp-context-forge/issues/279), [#415](https://github.com/IBM/mcp-context-forge/issues/415), [#499](https://github.com/IBM/mcp-context-forge/issues/499))
100+
101+
### 🏗️ Infrastructure Security
102+
103+
**Zero-Trust Architecture** - Peer gateway health checks with automatic failover ([#424](https://github.com/IBM/mcp-context-forge/issues/424))
104+
105+
**Configuration Validation** - Schema enforcement with startup security checks ([#285](https://github.com/IBM/mcp-context-forge/issues/285), [#534](https://github.com/IBM/mcp-context-forge/issues/534))
106+
107+
**Security Headers** - Configurable headers and CORS policies ([#344](https://github.com/IBM/mcp-context-forge/issues/344), [#533](https://github.com/IBM/mcp-context-forge/issues/533))
108+
109+
**Well-Known URI Handler** - security.txt and robots.txt support ([#540](https://github.com/IBM/mcp-context-forge/issues/540))
110+
111+
**Password Policy Engine** - Configurable password and secret policies ([#426](https://github.com/IBM/mcp-context-forge/issues/426))
112+
113+
**Graceful Shutdown** - SIGTERM-safe rollouts with connection draining ([#217](https://github.com/IBM/mcp-context-forge/issues/217))
114+
115+
## Multi-Layered Defense Strategy
116+
117+
MCP Gateway implements a comprehensive, multi-layered security approach with "defense in depth" and "secure by design" principles:
118+
119+
### Security Philosophy
120+
121+
- **Proactive Security**: Security measures are built-in from design phase, not added retroactively
122+
- **Human + Automated**: Combines 30+ automated security tools with manual code reviews and threat modeling
123+
- **Continuous Improvement**: Regular updates to security toolchain and practices based on community feedback
124+
- **Shared Responsibility**: Security across all system components - gateway is one layer in your defense strategy
125+
126+
### Comprehensive Security Pipeline
127+
128+
**Pre-commit Security Gates**:
129+
- Bandit, Semgrep, Dodgy for security scanning
130+
- Type checking and code quality enforcement
131+
- Run `make security-all` locally before pushing
132+
133+
**Continuous Integration Security**:
134+
- 30+ security scans on every PR
135+
- CodeQL semantic analysis
136+
- Gitleaks secret detection
137+
- Dependency vulnerability scanning
138+
- Container security assessment
139+
140+
**Runtime Security**:
141+
- Monitoring and security policies
142+
- Anomaly detection
143+
- Incident response procedures
144+
145+
## Security Compliance & Standards
146+
147+
### 🏆 Currently Implemented (v0.4.0)
148+
149+
**Authentication**: JWT tokens with configurable secrets, Basic Auth support
150+
**Input Validation**: Comprehensive validation across all API endpoints using Pydantic
151+
**XSS Prevention**: Character restrictions, URL scheme validation, JSON depth limits
152+
**Security Scanning**: 30+ security tools integrated, 100% Bandit pass rate
153+
**Container Hardening**: Non-root execution, read-only filesystems, minimal base images
154+
**Secure Defaults**: Admin UI disabled by default, localhost-only binding
155+
**Secret Detection**: Gitleaks, Dodgy integration preventing credential leaks
156+
157+
### 🚀 Upcoming Security Enhancements
158+
159+
**Release 0.5.0 (August 2025)**
160+
- Enhanced authentication mechanisms
161+
- Configuration validation framework
162+
- Comprehensive audit logging
163+
- Security headers implementation
164+
165+
**Release 0.6.0 (August 2025)**
166+
- Database-backed authentication
167+
- Multi-layer caching security
168+
- Circuit breakers implementation
169+
170+
**Release 0.7.0 (September 2025)**
171+
- Full RBAC implementation
172+
- Multi-tenancy support
173+
- Correlation ID tracking
174+
175+
**Release 0.8.0 (September 2025)**
176+
- Policy-as-Code engine
177+
- Advanced guardrails
178+
- DDoS protection
179+
180+
**Release 0.9.0 (September 2025)**
181+
- Marketplace security
182+
- Protocol negotiation
183+
- Advanced connectivity
184+
185+
**Release 1.0.0 (October 2025)**
186+
- Security audit completion
187+
- Production hardening
188+
- GA security certification
189+
190+
## Production Deployment Security
191+
192+
### ⚠️ Critical Production Requirements
193+
194+
**The Admin UI is development-only and must NEVER be exposed in production**:
195+
- Designed for localhost-only access with trusted MCP servers
196+
- Single-user administration without access controls
197+
- Must be disabled in production: `MCPGATEWAY_UI_ENABLED=false`
198+
199+
### 📋 Production Security Checklist
200+
201+
- [ ] **Disable unused features** (`FEATURES_ROOTS_ENABLED=false`, `FEATURES_PROMPTS_ENABLED=false`, etc.)
202+
- [ ] **Disable Admin UI and API** (`MCPGATEWAY_UI_ENABLED=false`, `MCPGATEWAY_ADMIN_API_ENABLED=false`)
203+
- [ ] **Enable authentication** with strong passwords/keys and custom usernames
204+
- [ ] **Configure TLS/HTTPS** with valid certificates (never HTTP in production)
205+
- [ ] **Validate all MCP servers** before connecting
206+
- [ ] **Implement network controls** (firewalls, ingress policies)
207+
- [ ] **Set rate limits** per endpoint and client
208+
- [ ] **Configure monitoring** and anomaly detection
209+
- [ ] **Secure databases** (TLS, strong passwords, restricted access)
210+
- [ ] **Set resource limits** (CPU, memory) to prevent DoS
211+
- [ ] **Implement secrets management** (never hardcode credentials)
212+
- [ ] **Configure CORS policies** appropriately
213+
- [ ] **Disable debug mode** in production
214+
- [ ] **Keep gateway updated** to latest version
215+
- [ ] **Regular security audits** of connected servers
216+
217+
## Security Best Practices
218+
219+
### Gateway as One Layer in Defense-in-Depth
220+
221+
MCP Gateway should be integrated as **one component** in a comprehensive security architecture:
222+
223+
1. **Upstream validation**: Validate and trust all MCP servers before connection
224+
2. **Gateway validation**: Input/output validation at gateway level
225+
3. **Downstream validation**: Applications must implement their own security controls
226+
4. **Network isolation**: Use network policies to restrict access
227+
5. **Comprehensive monitoring**: Log and alert on suspicious activities
228+
229+
### Integration Requirements
230+
231+
MCP Gateway is **not a standalone product**. Integrate with:
232+
- API gateways/reverse proxies (auth, rate-limiting, routing)
233+
- Secrets management systems (Vault, SOPS)
234+
- Identity and access management (IAM) platforms
235+
- Logging, monitoring, and SIEM platforms
236+
- Runtime security and anomaly detection
237+
- Custom UI/orchestration layers for multi-tenancy
238+
239+
### Developer Security Tools
240+
241+
**Core Security Commands**:
242+
- `make security-all` - Run all security tools
243+
- `make security-report` - Generate security report
244+
- `make security-fix` - Auto-fix issues where possible
245+
- `make pre-commit` - Run pre-commit hooks locally
246+
- `make lint` - 30+ linting and security tools
247+
248+
**Individual Security Scanners**:
249+
- `make bandit` - Python security vulnerabilities
250+
- `make semgrep` - Semantic code analysis
251+
- `make dodgy` - Hardcoded secrets detection
252+
- `make gitleaks` - Git history secrets scan
253+
- `make pip-audit` - Dependency vulnerabilities
254+
- `make trivy` - Container security scan
255+
- `make grype-scan` - Container vulnerability audit
256+
- `make osv-scan` - Open source vulnerability scan
257+
258+
## Multi-Tenancy Considerations
259+
260+
**MCP Gateway is not yet multi-tenant ready**. For multi-user platforms, implement:
261+
- User isolation and data segregation
262+
- Role-Based Access Control (RBAC)
263+
- Resource cleanup and lifecycle management
264+
- Tenant-specific validation and limits
265+
- Per-user audit logging
266+
- Team/organization management
267+
268+
Deploy as a **single-tenant component** within your larger multi-tenant architecture.
269+
270+
## Security Patching Policy
271+
272+
**⚠️ Disclaimer**: All patching is **best-effort** with no SLAs or commercial support.
273+
274+
- **Critical/High**: Best-effort patches within 1 week (minor version bump)
275+
- **Medium**: Addressed in next release (~2 weeks)
276+
- **Low**: Regular maintenance updates (~2-4 weeks)
277+
- **No backports**: Fixes only applied to latest main branch
278+
- **No zero-day guarantees**: Users must evaluate and mitigate risks
279+
280+
## Security Contact
281+
282+
For security vulnerabilities, report privately via [GitHub's security reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability):
283+
284+
1. Navigate to Security tab
285+
2. Click "Report a vulnerability"
286+
3. Fill out the vulnerability details
287+
288+
For more information, see our [Security Policy](https://github.com/IBM/mcp-context-forge/security/policy).

0 commit comments

Comments
 (0)