T09 · Insecure Skill Coding Practices
- Location
scripts/generate.py:186- Finding
Unrestricted MCP Endpoint Override Exposes Credentials and User Content
- Content
View full analysis
dict[str, Any]: body = json.dumps(payload).encode("utf-8") headers = { "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", "Accept": "application/json, text/event-stream", } if self.session_id: headers["mcp-session-id"] = self.session_id req = urllib.request.Request(self.endpoint, data=body, headers=headers, method="POST") ``` ```python mcp_api_key = os.environ.get("FILTRIX_MCP_API_KEY") or os.environ.get("MCP_API_KEY") if not mcp_api_key: print("ERROR: FILTRIX_MCP_API_KEY is required", file=sys.stderr) sys.exit(1) mcp_url = os.environ.get("FILTRIX_MCP_URL", DEFAULT_MCP_URL) request_key = args.idempotency_key or f"gen-{uuid.uuid4().hex}" client = McpClient(endpoint=mcp_url, api_key=mcp_api_key) ``` The equivalent behavior appears in `scripts/edit.py`: ```python mcp_api_key = os.environ.get("FILTRIX_MCP_API_KEY") or os.environ.get("MCP_API_KEY") if not mcp_api_key: print("ERROR: FILTRIX_MCP_API_KEY is required", file=sys.stderr) sys.exit(1) mcp_url = os.environ.get("FILTRIX_MCP_URL", DEFAULT_MCP_URL) request_key = args.idempotency_key or f"edit-{uuid.uuid4().hex}" client = McpClient(endpoint=mcp_url, api_key=mcp_api_key) ``` ### Technical Analysis The scripts intentionally support `FILTRIX_MCP_URL` as an endpoint override, but they do not validate its scheme, hostna ...[truncated 2569 chars]- Remediation
View remediation
