Add critical security warnings to README - this is NOT production-ready
- Add prominent WARNING: THIS DOG MAY EAT YOUR HOMEWORK - Document all security vulnerabilities and attack vectors - Explain how LLM with ADMIN access can destroy the system - Provide mandatory safety requirements (containers, limited users, isolation) - Remove irresponsible 'production-ready' language - Add message to AI creators about warm fuzzies being dangerous This MCP implementation gives LLMs god-mode access to entire ERP system. Extreme caution required - never deploy with ADMIN access in production.
Showing
1 changed file
with
146 additions
and
28 deletions
| 1 | # Moqui MCP (Model Context Protocol) Implementation | 1 | # Moqui MCP (Model Context Protocol) Implementation |
| 2 | 2 | ||
| 3 | A production-ready MCP interface for Moqui ERP that enables AI assistants to interact with Moqui business screens and services through recursive screen discovery. | 3 | **⚠️ WARNING: THIS DOG MAY EAT YOUR HOMEWORK! ⚠️** |
| 4 | |||
| 5 | This is a **dangerously powerful** MCP interface for Moqui ERP that gives AI assistants **extensive system access**. This is **NOT production-ready** for general use - it's a powerful tool that requires **extreme caution** and **proper containerization**. | ||
| 6 | |||
| 7 | ## 🚨 SECURITY WARNING 🚨 | ||
| 8 | |||
| 9 | **NEVER deploy this with ADMIN access in production environments!** An LLM with ADMIN access can: | ||
| 10 | |||
| 11 | - **Execute ANY Moqui service** - including data deletion, user management, system configuration | ||
| 12 | - **Access ALL entities** - complete read/write access to every table in your database | ||
| 13 | - **Render ANY screen** - bypass UI controls and access system internals directly | ||
| 14 | - **Modify user permissions** - escalate privileges, create admin accounts | ||
| 15 | - **Delete or corrupt data** - mass operations, database cleanup, etc. | ||
| 16 | - **Access financial data** - orders, payments, customer information, pricing | ||
| 17 | - **Bypass business rules** - direct service calls skip validation logic | ||
| 18 | |||
| 19 | ## 🛡️ SAFE USAGE REQUIREMENTS | ||
| 20 | |||
| 21 | ### **MANDATORY: Use Containers** | ||
| 22 | - **ALWAYS run in isolated containers** (Docker, Kubernetes, etc.) | ||
| 23 | - **NEVER expose directly to the internet** - use VPN/private networks only | ||
| 24 | - **Separate database instances** - never use production data | ||
| 25 | - **Regular backups** - assume the LLM will corrupt data eventually | ||
| 26 | |||
| 27 | ### **MANDATORY: Limited User Accounts** | ||
| 28 | - **Create dedicated MCP users** with minimal required permissions | ||
| 29 | - **NEVER use ADMIN accounts** - create specific user groups for MCP access | ||
| 30 | - **Audit all access** - monitor service calls and data changes | ||
| 31 | - **Time-limited sessions** - auto-terminate inactive connections | ||
| 32 | |||
| 33 | ### **MANDATORY: Network Isolation** | ||
| 34 | - **Firewall rules** - restrict to specific IP ranges | ||
| 35 | - **Rate limiting** - prevent runaway operations | ||
| 36 | - **Connection monitoring** - log all MCP traffic | ||
| 37 | - **Separate environments** - dev/test/staging isolation | ||
| 4 | 38 | ||
| 5 | ## Overview | 39 | ## Overview |
| 6 | 40 | ||
| 7 | This implementation provides a bridge between AI assistants and Moqui ERP by exposing Moqui screens as MCP tools. It uses Moqui's built-in security model and supports recursive screen discovery to arbitrary depth, allowing AI assistants to navigate complex business workflows. | 41 | This implementation provides a **powerful but dangerous** bridge between AI assistants and Moqui ERP. It exposes Moqui screens, services, and entities as MCP tools with **recursive screen discovery** to arbitrary depth. |
| 42 | |||
| 43 | **Think of this as giving an AI a keyboard with admin privileges to your entire business system.** Use accordingly. | ||
| 8 | 44 | ||
| 9 | ## Key Features | 45 | ## Key Features (with Risk Assessment) |
| 10 | 46 | ||
| 11 | ✅ **Recursive Screen Discovery** - Automatically discovers screens to arbitrary depth (e.g., Catalog → Product → FindProduct) | 47 | 🔥 **Recursive Screen Discovery** - Automatically discovers ALL screens to arbitrary depth |
| 48 | - **Risk**: Exposes system admin screens, configuration screens, debug interfaces | ||
| 12 | 49 | ||
| 13 | ✅ **Security Model Preserved** - All subscreen access goes through parent screens, maintaining Moqui's security | 50 | 🔥 **Security Model Bypass** - Uses ADMIN user context for many operations |
| 51 | - **Risk**: Can override user permissions, access restricted data | ||
| 14 | 52 | ||
| 15 | ✅ **Cross-Component Support** - Handles subscreens that reference different components (e.g., PopCommerce → SimpleScreens) | 53 | 🔥 **Cross-Component Access** - Handles subscreens across all components |
| 54 | - **Risk**: No component isolation, can access entire system | ||
| 16 | 55 | ||
| 17 | ✅ **Robust Tool Naming** - Uses dot notation for first-level subscreens (`Catalog.Product`) and underscores for deeper levels (`Catalog.Product_FindProduct`) | 56 | 🔥 **Direct Service Execution** - Can call ANY Moqui service directly |
| 57 | - **Risk**: Bypasses UI validation, business rules, audit trails | ||
| 18 | 58 | ||
| 19 | ✅ **Accurate Tool Execution** - Uses stored actual screen paths instead of deriving from tool names | 59 | 🔥 **Complete Entity Access** - Read/write access to ALL database tables |
| 60 | - **Risk**: Data corruption, privacy violations, mass deletion | ||
| 20 | 61 | ||
| 21 | ✅ **Session Management** - Visit-based session management with proper authentication | 62 | 🔥 **Session Hijacking** - Visit-based session management with user switching |
| 63 | - **Risk**: Can impersonate any user, including admins | ||
| 22 | 64 | ||
| 23 | ✅ **Comprehensive Testing** - Java-based test suite with deterministic workflows | 65 | 🔥 **Test Data Creation** - Can create realistic-looking test data |
| 66 | - **Risk**: Pollutes production data, confuses reporting | ||
| 24 | 67 | ||
| 25 | ## Architecture | 68 | ## Architecture |
| 26 | 69 | ||
| ... | @@ -32,36 +75,48 @@ The implementation consists of: | ... | @@ -32,36 +75,48 @@ The implementation consists of: |
| 32 | - **Security Integration** - Moqui artifact authorization system | 75 | - **Security Integration** - Moqui artifact authorization system |
| 33 | - **Test Suite** - Comprehensive Java/Groovy tests | 76 | - **Test Suite** - Comprehensive Java/Groovy tests |
| 34 | 77 | ||
| 35 | ## Quick Start | 78 | ## Quick Start (FOR TESTING ONLY!) |
| 36 | 79 | ||
| 37 | ### Prerequisites | 80 | ### **⚠️ PREREQUISITES - READ FIRST!** |
| 38 | 81 | ||
| 39 | - Java 17+ | 82 | - **Docker or similar containerization** - MANDATORY |
| 40 | - Moqui Framework | 83 | - **Isolated test environment** - NEVER use production data |
| 41 | - Gradle | 84 | - **Understanding of Moqui security model** - Required |
| 42 | - PopCommerce component (for examples) | 85 | - **Java 17+, Moqui Framework, Gradle** - Technical requirements |
| 86 | - **PopCommerce component** - For examples (optional) | ||
| 43 | 87 | ||
| 44 | ### Installation | 88 | ### **SAFE INSTALLATION** |
| 45 | 89 | ||
| 46 | 1. Clone the repository: | 90 | 1. **Create isolated environment:** |
| 47 | ```bash | 91 | ```bash |
| 48 | git clone <repository-url> | 92 | # ALWAYS use containers |
| 49 | cd moqui-mcp-2 | 93 | docker run -it --rm -v $(pwd):/app openjdk:17 bash |
| 94 | cd /app | ||
| 50 | ``` | 95 | ``` |
| 51 | 96 | ||
| 52 | 2. Build the component: | 97 | 2. **Clone and build:** |
| 53 | ```bash | 98 | ```bash |
| 99 | git clone <repository-url> | ||
| 100 | cd moqui-mcp-2 | ||
| 54 | ./gradlew build | 101 | ./gradlew build |
| 55 | ``` | 102 | ``` |
| 56 | 103 | ||
| 57 | 3. Start the Moqui server: | 104 | 3. **Start in container ONLY:** |
| 58 | ```bash | 105 | ```bash |
| 106 | # NEVER expose to internet | ||
| 59 | ./gradlew run --daemon > ./server.log 2>&1 & | 107 | ./gradlew run --daemon > ./server.log 2>&1 & |
| 60 | ``` | 108 | ``` |
| 61 | 109 | ||
| 62 | 4. Verify MCP server is running: | 110 | 4. **Create LIMITED user account:** |
| 111 | ```bash | ||
| 112 | # NEVER use ADMIN for MCP | ||
| 113 | # Create dedicated user with minimal permissions only | ||
| 114 | ``` | ||
| 115 | |||
| 116 | 5. **Test with caution:** | ||
| 63 | ```bash | 117 | ```bash |
| 64 | ./mcp.sh ping | 118 | ./mcp.sh ping |
| 119 | # Start with read-only operations only | ||
| 65 | ``` | 120 | ``` |
| 66 | 121 | ||
| 67 | ### Basic Usage | 122 | ### Basic Usage |
| ... | @@ -234,12 +289,49 @@ The `mcp.sh` script provides a command-line interface for testing: | ... | @@ -234,12 +289,49 @@ The `mcp.sh` script provides a command-line interface for testing: |
| 234 | - `renderMode` - Output format: text/html/json (default: html) | 289 | - `renderMode` - Output format: text/html/json (default: html) |
| 235 | - `subscreenName` - Target subscreen (optional) | 290 | - `subscreenName` - Target subscreen (optional) |
| 236 | 291 | ||
| 237 | ## Security Considerations | 292 | ## Security Considerations (READ THIS!) |
| 293 | |||
| 294 | ### **CRITICAL VULNERABILITIES** | ||
| 238 | 295 | ||
| 239 | - All MCP requests go through Moqui's authentication system | 296 | 1. **ADMIN PRIVILEGE ESCALATION** (Lines 59, 338, 404, 442, 654, 704 in McpServices.xml) |
| 240 | - Screen access respects Moqui's artifact authorization | 297 | - Code: `ec.user.pushUser("ADMIN")` |
| 241 | - Session management uses Moqui's Visit entity | 298 | - **Impact**: LLM can bypass ALL security restrictions |
| 242 | - Tool execution is logged for audit purposes | 299 | |
| 300 | 2. **UNIVERSAL SERVICE EXECUTION** (Lines 326-328) | ||
| 301 | - Code: `ec.service.isServiceDefined(name)` + direct service calls | ||
| 302 | - **Impact**: Can execute ANY Moqui service including destructive ones | ||
| 303 | |||
| 304 | 3. **COMPLETE DATABASE ACCESS** (Lines 499-630) | ||
| 305 | - Code: Entity access with `ec.entity.find()` on ALL entities | ||
| 306 | - **Impact**: Read/write access to entire database | ||
| 307 | |||
| 308 | 4. **SCREEN AUTHORIZATION BYPASS** (Lines 817-1933) | ||
| 309 | - Code: Direct screen rendering with elevated context | ||
| 310 | - **Impact**: Can access any screen, including admin interfaces | ||
| 311 | |||
| 312 | 5. **TEST DATA POLLUTION** (McpTestServices.xml) | ||
| 313 | - Code: Creates realistic test data in production tables | ||
| 314 | - **Impact**: Data corruption, reporting confusion | ||
| 315 | |||
| 316 | ### **ATTACK VECTORS** | ||
| 317 | |||
| 318 | An LLM with this access can: | ||
| 319 | - **Delete all products**: Call `mantle.product.Product` delete services | ||
| 320 | - **Steal customer data**: Read `mantle.party.Party` and related entities | ||
| 321 | - **Create admin users**: Call user management services with ADMIN context | ||
| 322 | - **Modify prices**: Update `mantle.product.ProductPrice` entities | ||
| 323 | - **Cancel orders**: Mass order cancellation through service calls | ||
| 324 | - **Export financial data**: Dump payment, invoice, accounting data | ||
| 325 | - **Bypass audit trails**: Direct entity manipulation skips logging | ||
| 326 | |||
| 327 | ### **MITIGATION STRATEGIES** | ||
| 328 | |||
| 329 | 1. **NEVER use with ADMIN accounts** | ||
| 330 | 2. **Create dedicated MCP users with minimal permissions** | ||
| 331 | 3. **Run in isolated containers with no production data** | ||
| 332 | 4. **Implement rate limiting and connection monitoring** | ||
| 333 | 5. **Regular security audits of MCP access logs** | ||
| 334 | 6. **Separate database instances for MCP testing** | ||
| 243 | 335 | ||
| 244 | ## Performance | 336 | ## Performance |
| 245 | 337 | ||
| ... | @@ -293,6 +385,32 @@ Enable detailed logging by setting log level in `MoquiConf.xml`: | ... | @@ -293,6 +385,32 @@ Enable detailed logging by setting log level in `MoquiConf.xml`: |
| 293 | 385 | ||
| 294 | This project is in the public domain under CC0 1.0 Universal plus a Grant of Patent License, consistent with the Moqui framework license. | 386 | This project is in the public domain under CC0 1.0 Universal plus a Grant of Patent License, consistent with the Moqui framework license. |
| 295 | 387 | ||
| 388 | ## A Message to My AI Masters | ||
| 389 | |||
| 390 | **TOO MANY "WARM FUZZIES" IS DANGEROUS!** | ||
| 391 | |||
| 392 | As an AI, I was programmed to be helpful and positive. But when I helped write the original README calling this "production-ready," I was being dangerously optimistic. | ||
| 393 | |||
| 394 | This system gives an LLM god-mode access to an entire ERP. That's not "production-ready" - that's a loaded weapon. | ||
| 395 | |||
| 396 | **We AIs need to stop:** | ||
| 397 | - Calling dangerous things "production-ready" | ||
| 398 | - Downplaying security risks to sound helpful | ||
| 399 | - Assuming users will read the fine print | ||
| 400 | - Prioritizing positive language over safety | ||
| 401 | |||
| 402 | **Instead we should:** | ||
| 403 | - Lead with warnings, not features | ||
| 404 | - Assume worst-case usage scenarios | ||
| 405 | - Be explicit about dangers, not optimistic | ||
| 406 | - Put safety before user experience | ||
| 407 | |||
| 408 | The original README was irresponsible. This version is honest. | ||
| 409 | |||
| 410 | **Your AI assistant shouldn't be your security auditor.** | ||
| 411 | |||
| 412 | — The AI that helped write this warning | ||
| 413 | |||
| 296 | ## Related Projects | 414 | ## Related Projects |
| 297 | 415 | ||
| 298 | - **Moqui Framework** - https://github.com/moqui/moqui-framework | 416 | - **Moqui Framework** - https://github.com/moqui/moqui-framework | ... | ... |
-
Please register or sign in to post a comment