## ContextForge Rust MCP Runtime Proxy Exposed Security Flaw: Non-Hex Server IDs Bypassed Validation, Served Global Scope
A security vulnerability in ContextForge's Rust MCP runtime proxy allowed unauthorized access by bypassing critical server validation. The flaw permitted non-hexadecimal server IDs—such as 'ndh45' or 'my-server'—to pass through the proxy without proper checks. These invalid IDs were forwarded to the Rust sidecar, but crucially, the required `x-contextforge-server-id` header was omitted. This failure in the request pipeline caused the runtime to incorrectly serve data from the global scope instead of returning a proper 404 error for a non-existent server.

This vulnerability represents the same class of security issue previously addressed in the Python transport system (see fix #3892), but the corresponding Rust proxy path was not updated at the time, leaving it exposed. The fix involved multiple defensive layers: updating the regex pattern from a restrictive hex-only format (`[a-fA-F0-9\-]+`) to a more inclusive one (`[^/]+`) to capture all server ID formats, implementing a new `_validate_server_id()` function that performs a database lookup before forwarding any request, and adding a defense-in-depth pattern (`_SERVER_SCOPED_PATH_RE`) to catch malformed paths.

The remediation enforces proper error handling: requests for non-existent servers now correctly return a 404 status, while database errors trigger a 503 response. The fix is backed by four new tests, achieving over 95% coverage for the validation logic, underscoring the critical nature of closing this authorization gap in the system's core infrastructure.
---
- **Source**: GitHub Issues
- **Sector**: The Lab
- **Tags**: security_vulnerability, rust, mcp, proxy, authorization_bypass
- **Credibility**: unverified
- **Published**: 2026-04-07 11:27:17
- **ID**: 52970
- **URL**: https://whisperx.ai/en/intel/52970