Repository navigation
build: Move to TypeScript 7, pnpm 12 and a shared strict policy - #2266
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| const server = new McpServer( | ||
| { | ||
| ...MCP_SERVER_INFO, | ||
| version: getServerVersion(), | ||
| }, | ||
| { | ||
| maxToolInputElements: MAX_TOOL_INPUT_ELEMENTS, | ||
| instructions: buildServerInstructions( | ||
| new Set(registrations.map(({ name }) => name)), | ||
| ), | ||
| ...(instructions !== undefined && { instructions }), | ||
| }, | ||
| ); |
There was a problem hiding this comment.
🟠 High severity issue identified in your code:
Risk: Affected 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 maxToolInputElements McpServer option and lower maxRequestBodySize.
Manual Review Advice: A vulnerability from this advisory is reachable if you expose the McpServer over an HTTP transport (Streamable HTTP, SSE, or createMcpHandler) rather than stdio only and it registers tools that accept input, especially arrays or records
Fix: Upgrade this library to at least version 2.3.0 at toolkit/pnpm-lock.yaml:3187.
Reference(s): https://euvd.enisa.europa.eu/vulnerability/EUVD-2026-117803, GHSA-46jr-4wx8-v453
🥳 Fixed in commit ed3902b 🥳
There was a problem hiding this comment.
This PR doesn't introduce or change this dependency. pnpm-lock.yaml on main has the same entries: @modelcontextprotocol/server 2.0.0 and 2.4.0, and @modelcontextprotocol/sdk 1.32.2. The finding lands on this line only because the PR also edits server.ts.
The 2.0.0 copy, which is older than the 2.3.0 fix, comes only through @mastra/core in apps/docs-mcp. @sentry/mcp-core and @sentry/mcp-cloudflare resolve 2.4.0.
Upgrading the dependency is a separate security fix, so it shouldn't ride along with this tooling migration. I'm leaving the triage (/fp, /ar, or an upgrade) to the code owners rather than marking it here.
9724d06 to
527d979
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rebase onto main pulled in code written without the strict tsconfig policy and the type-aware lint rules, so the gate failed on it. Fix that code in place: noUncheckedIndexedAccess index reads, bracket access for index signatures, exactOptionalPropertyTypes boundaries (widen own option bags and class fields, omit or spread absent optionals at third-party boundaries, JSON.stringify now typed as returning string), object-wrapped flags that control flow narrows to their initial literal, and the lint rules' fallout (no-unnecessary-condition, no-non-null-assertion, no-misused-promises). The two abort-reason rejections keep the platform's verbatim reason behind scoped suppressions. Co-Authored-By: Inkling 2 Small Free <inkling-2-small-free@users.noreply.github.com>
527d979 to
ed3902b
Compare
The bracket-access conversion replaced env.SENTRY_HANDOFF with env[""], so the handoff code never reached setup.
|
This PR is too large for Bugbot to review. It changes 22,595 lines and 3,684,439 characters. Split the change into smaller pull requests to get a review. |
Replace oxlint-tsgolint with tsrs 7.1.0-beta.tsrs3, the first release on npm's latest tag. Oxlint prefers tsrs-lint when both backends are on the path; drop oxlint's optional oxlint-tsgolint peer in .pnpmfile.cjs because pnpm 12 installs it anyway and nothing would run it. Full-repo type-aware lint drops from about 8s to about 2s locally with the same diagnostics. Typecheck stays on TypeScript 7.0, and the mcp-core, logger and mcp-server-mocks declarations are unchanged. tsrs3 is newer than the release-age window, so its packages are excluded explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups from the #2266 review. ## Changes - **mcp-cloudflare regression tests.** An approval cookie with an empty signature is rejected without reporting an error to Sentry (before #2266 it threw inside `verifySignature` and went through `logError`). `/api/chat` answers a non-`Error` throw with a JSON 500 and an event ID (before #2266 Hono returned plain-text "Internal Server Error" and nothing was logged). Both tests fail against the pre-#2266 code. - **tsconfig policy.** `typecheckCommandConfigs` throws for a type check command other than `tsc`, `astro check`, or a `pnpm`/`node` setup step. Before, such a command added no program, so a package could switch checkers and drop out of the option checks unnoticed. - **apps/local `withoutUndefined`.** Accepts only plain records (`Record<string, unknown>`), since it copies own enumerable string keys. Class instances and interface-typed values no longer type-check; a test pins that. - **CLI metric alert filter.** Removes the `as string | null` guard and its "null name" test. The command reads `/detectors/`, and Sentry's `Detector.name` is a non-null `CharField` in every migration, so the guard covered a response Sentry cannot send. This matches how #2266 already treats issue-alert names. ## Not changed - The `state.ts` empty-signature guard has no observable effect: `verifyAndParseState` rejects an empty signature first, and that catch never logged. - The Web Vitals `available[0] ?? chosenMetric` fallback is unreachable: `webVitalPages` drops visits without metrics, so no test can drive it. - mcp-core's `.d.ts` output can differ between builds only in the order of union members in inferred types. The types are identical. - The CLI, MCP and apps/local each keep their own `omitUndefined`/`withoutUndefined` helper. Merging them into toolkit-core is a separate change. ## Verification `pnpm run typecheck`, `pnpm run lint`, `pnpm run test:ci-projects` (194 pass), mcp-cloudflare (469) and apps/local (466) suites pass. CLI alert tests pass except `alert issues delete > dry-run`, which fails locally on `main` too because `pnpm exec` adds an `npx -y` prefix to its expected usage hint. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Toolkit was on TypeScript 5.9 and pnpm 11, each project had its own type-check settings, and many tests, scripts, Worker and build configs were never type-checked in CI. This moves the workspace to TypeScript 7.0.2 and pnpm 12.18.0, applies one strict tsconfig policy to every maintained TypeScript file, and adds stronger type-aware Oxlint rules. Published package contracts are unchanged.
This single PR supersedes the stacked #2240, #2187, #2238, and #2239: everything those branches carried is here, rebased onto current
main(which also carries #2186). #2187's metric alert query filter fix is included as a cherry-pick. It follows that stack's layout: one roottsconfig.base.jsonthat every project extends, no@sentry/mcp-server-tsconfigpackage, and one root.oxlintrc.json.Intermediate commits are not individually green; squash-merge.
Changes
tsconfig.base.jsonkeeps the stack's runtime defaults and adds the rest of the checking policy. Projects set only runtime options such as target, module, lib, types, JSX and emit. The policy enables:strict,noUncheckedIndexedAccess,exactOptionalPropertyTypes,noPropertyAccessFromIndexSignatureverbatimModuleSyntax,erasableSyntaxOnlynoUnused*checksskipLibCheck: falsetypecheckscript runs.scripts/tsconfig-policy.test.mjsreads the policy from the root base and guards against:@typescript/typescript6.only-throw-errorand related safety rules.any,!, unnecessary conditions and unsafeanyflows./api/chatnow returns a 500 for a non-Errorthrow.command-api.jsonregained the fixed query notes it had lost.Impact
packageManagerpin. The first switch adds@pnpm/exeentries topnpm-lock.yaml; discard them.typecheckis the canonical script.tscremains as an alias.@sentry/mcp-coreand@sentry/loggerbefore lint, because type-aware rules read workspace packages through their built declarations.Exceptions
packages/codemod-cli3to4/tsconfig.jsonrepeats the checking options instead of extending the root, becausejssgcannot resolve anextendsoutside the package. The policy test fails if the copy drifts.skipLibCheck: true, each with a comment naming the dependency, the diagnostic and when to remove it:aideclarations (underexactOptionalPropertyTypes, and DOM or Node names they reference)@cloudflare/workers-typesconflicting with@types/nodeglobals, andurlpattern-polyfillagainst the workers-typesURLPatternglobalwranglerandminiflaredeclarations referencing packages they bundle but do not shipunpluginandvitedeclarations referencing packages they don't shiphonodeclarations using DOM names in the Node programapps/cli-docskeepsastro checkon TypeScript 6 until@astrojs/checksupports TypeScript 7.~5.0.5. Vitest 5.1 needsAsyncLocalStorage.disable(), which workerd lacks. Remove the pin once@cloudflare/vitest-plugin≥ 1.7.0 is adopted.tsrs-lint, which tracks the TypeScript 7.1 beta.pnpm run typecheckstays on TypeScript 7.0 and is the type gate..pnpmfile.cjsdrops oxlint's optionaloxlint-tsgolintpeer, which pnpm 12 would otherwise install unused. tsrs3 is newer than the release-age window, so its packages are inminimumReleaseAgeExclude.Open questions
chat-message.tsx, the tool-part state mapping never sees"result"under AI SDK v6. That bug predates this PR and is left as is.Refs getsentry/junior#2171
via @joshuarli.
--
View Session [Sentry]