Repository navigation
fix(docs-mcp): Limit request bodies and tool input elements #1784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; | ||
| import * as Sentry from "@sentry/cloudflare"; | ||
| import { MAX_TOOL_INPUT_ELEMENTS } from "@sentry/toolkit-core/mcp-limits"; | ||
| import { type ZodRawShape, z } from "zod"; | ||
| import { runFeaturesAgent } from "./agent/features-agent"; | ||
| import { runTailorAgent } from "./agent/tailor-agent"; | ||
|
|
@@ -149,12 +150,15 @@ export function createMcpServer( | |
| docsVersion?: string, | ||
| ) { | ||
| const mcp = Sentry.wrapMcpServerWithSentry( | ||
| new McpServer({ | ||
| description: | ||
| "Generates tailored Sentry integration docs by reading docs.sentry.io.", | ||
| name: "sentry-docs", | ||
| version: "1.0.0", | ||
| }), | ||
| new McpServer( | ||
| { | ||
| description: | ||
| "Generates tailored Sentry integration docs by reading docs.sentry.io.", | ||
| name: "sentry-docs", | ||
| version: "1.0.0", | ||
| }, | ||
| { maxToolInputElements: MAX_TOOL_INPUT_ELEMENTS }, | ||
| ), | ||
|
Comment on lines
+153
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. High severity vulnerability may affect your project—review required: ℹ️ Why this mattersAffected versions of @modelcontextprotocol/sdk and @modelcontextprotocol/server are vulnerable to Allocation of Resources Without Limits or Throttling. McpServer places no limit on how many array elements and object keys it validates in tool-call arguments. A single unauthenticated HTTP request within the default 4 MiB body limit can exhaust the Node.js heap during validation and crash the server process (denial of service). After upgrading, also set the opt-in References: GHSA To resolve this comment:
💬 Ignore this findingTo ignore this, reply with:
You can view more details on this finding in the Semgrep AppSec Platform here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't apply to the Docs MCP Worker. The The Leaving this thread open so a human can triage the finding in Semgrep. |
||
| { | ||
| recordInputs: true, | ||
| recordOutputs: true, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.