Skip to content

fix(deps): Resolve pnpm audit security advisories - #2318

Merged
BYK merged 2 commits into
mainfrom
security/deps-audit-fixes
Nov 17, 2026
Merged

BYK merged 2 commits into
mainfrom
security/deps-audit-fixes

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes all 52 advisories that pnpm audit reports on main (2 critical, 28 high, 15 moderate, 7 low), so pnpm audit now finds none. The list comes from pnpm audit because Junior couldn't read the repo's Dependabot alerts, so it may not match the Dependabot alert list exactly.

Review points

  • @sentry/vite-plugin 4 → 11.12.0 (mcp-cloudflare). This matches the other @sentry/* catalog pins and shares @sentry/[email protected] with @sentry/cloudflare. The 5.x line still pulls vulnerable glob 13, so 11.x is the first release that clears the glob advisories without an override. The existing sentryVitePlugin({ org, project }) config works unchanged, and builds still inject debug IDs.
  • @mastra/core 1.63 → 1.83 (apps/docs-mcp). The range is ^1.68.0, which resolves to 1.83.0. The newer versions no longer depend on the vulnerable @modelcontextprotocol/[email protected].

Advisories fixed

Package Advisories Severity Old → new How
shell-quote GHSA-pqg4-j6r4-53mv critical 1.10.0 → 1.12.0 packages/cli ^1.11.0
seroval GHSA-p6vx-979v-rg4c, GHSA-7rv5-mrxv-xcr9, GHSA-97r2-qh9m-474h, GHSA-jp82-f5mq-hwhp, GHSA-wp97-x4hv-qvhp, GHSA-9wx9-5pv9-3349 critical / high / moderate 1.5.6 → 1.8.1 asciinema-player ^3.18.1, override raised to seroval: ^1.6.11
@modelcontextprotocol/server GHSA-46jr-4wx8-v453, GHSA-f897-62hf-6gxq, GHSA-jm63-cq47-j5jp, GHSA-rvq5-wwqv-78pq high / moderate 2.0.0 → no longer used by @mastra/core @mastra/core ^1.68.0
linkify-it, lodash, markdown-it, tmp, underscore GHSA-22p9-wv53-3rq4, GHSA-v245-v573-v5vm, GHSA-r5fr-rjxr-66jc, GHSA-xxjr-mmjv-4gpg, GHSA-gfr2-rv44-r23c, GHSA-r7fv-28h4-cvq7, GHSA-vfgh-jcmw-g37q, GHSA-253c-mchw-3w2r, GHSA-38c4-r59v-3vqw, GHSA-6v5v-wf23-fmfq, GHSA-ph9p-34f9-6g65, GHSA-52f5-9888-hmc6, GHSA-qpx9-hpmf-5gmw high / moderate / low removed Dropped the unused workers-mcp dependency and catalog entry from mcp-cloudflare (nothing imports it)
glob, minimatch, brace-expansion GHSA-3g3m-2fjr-6pw4, GHSA-23c5-xmqv-rm74, GHSA-3ppc-4f35-3m26, GHSA-7r86-cg39-jmmj, GHSA-g3hv-75wg-m249, GHSA-3jxr-9vmj-r5cp, GHSA-6j4f-fj2g-mc7p, GHSA-mh99-v99m-4gvg, GHSA-qhr7-859c-m2p7, GHSA-rgw5-rvv9-x895, GHSA-f886-m6hf-6m8v, GHSA-q2hr-2g5m-vwhr high / moderate glob 10.5.0 → 14.0.4 @sentry/vite-plugin 4.6.1 → 11.12.0
react-router GHSA-qwww-vcr4-c8h2 high 7.18.1 → 7.18.4 / 7.18.5 react-router-dom ^7.18.2
browserslist GHSA-73wf-gq98-2v4g, GHSA-c83g-rgw3-j3cx high 4.25.1 → 4.29.5 override browserslist: ^4.28.7
defu GHSA-737v-mqg7-c878 high 6.1.4 → 6.1.7 override defu: ^6.1.5
path-to-regexp GHSA-j3q9-mxjg-w52f, GHSA-27v5-c462-wpq7 high / moderate 8.3.0 → 8.4.2 override "path-to-regexp@8": ^8.4.0
source-map-js GHSA-68fv-2mgg-jv7q high 1.2.1 → 1.2.2 override source-map-js: ^1.2.2
fast-uri GHSA-w74x-v6f9-j3xg, GHSA-wjr9-j795-jxcr, GHSA-333x-w4r6-6crp, GHSA-xhq7-xmqj-769h moderate / low 3.1.8 → 3.1.9 "fast-uri@3": ^3.1.9 replaces the [email protected]>fast-uri pin
mdast-util-to-hast GHSA-4fh9-h7wg-q85m moderate 13.2.0 → 13.2.2 override mdast-util-to-hast: ^13.2.1
postcss-selector-parser GHSA-rj75-hqrm-r3gf moderate 6.0.10 / 6.1.4 → 6.1.6 override "postcss-selector-parser@6": ^6.1.5
@ai-sdk/provider-utils GHSA-866g-f22w-33x8 low 4.0.11 → ≥4.0.40 override "@ai-sdk/provider-utils@4": ^4.0.33
@babel/core GHSA-4x5r-pxfx-6jf8 low 7.28.0 → 7.29.13 override "@babel/core@7": ^7.29.6
diff GHSA-73rr-hh4g-fpgx low 8.0.2 → 8.0.4 override "diff@8": ^8.0.3

All existing overrides stay, including zod: ^4.6.6.

via @BYK.

--

View Session [Sentry]

Bump shell-quote, asciinema-player, react-router-dom, and @mastra/core
to patched releases, drop the unused workers-mcp dependency, and add
pnpm overrides for vulnerable transitive packages that have in-range
fixes. Force glob 14 under @sentry/bundler-plugin-core@4, which has no
release off vulnerable glob 10.

pnpm audit now reports no known vulnerabilities.

Co-Authored-By: BYK <[email protected]>
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 17, 2026 3:22pm UTC

Request Review

@BYK
BYK marked this pull request as ready for review November 17, 2026 15:12
@BYK
BYK requested a review from a team as a code owner November 17, 2026 15:12
@sentry-junior
sentry-junior Bot requested a review from BYK November 17, 2026 15:12

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forced glob 10 → 14 under @sentry/bundler-plugin-core@4 (via @sentry/vite-plugin in mcp-cloudflare). No 4.x release has a fix: 4.9.1 still depends on glob ^10.5.0. This override clears the glob, minimatch, and brace-expansion advisories, but no production build that uploads source maps has run with glob 14 yet. The other option is the major bump to @sentry/vite-plugin 5.

Prefer upgrading @sentry/vite-plugin to 5

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 17, 2026
Replace the glob override under @sentry/bundler-plugin-core@4 with an
upgrade of @sentry/vite-plugin to 11.12.0, matching the other @sentry
catalog pins. The 5.x line still pulls vulnerable glob 13; 11.12.0 uses
@sentry/bundler-plugins with glob ^14.0.3.
@BYK
BYK enabled auto-merge (squash) November 17, 2026 15:26
@BYK
BYK merged commit e088a87 into main Nov 17, 2026
44 checks passed
@BYK
BYK deleted the security/deps-audit-fixes branch November 17, 2026 15:33
MathurAditya724 pushed a commit that referenced this pull request Nov 17, 2026
Removes `@mastra/core` from the private `apps/docs-mcp` Worker. Mastra
was only used there, as a wrapper around the AI SDK (`ai` 5), which the
Worker already depends on. The three agents now call `generateText`
directly. This drops 44 packages from the install and shrinks the Worker
bundle from 14.8 MiB (2.74 MiB gzip) to 2.5 MiB (481 KiB gzip).

This removes `@mastra/core`, which #2318 bumped to
clear the `@modelcontextprotocol/server` advisories. With Mastra gone,
docs-mcp no longer pulls `@modelcontextprotocol/server` in at all. The
only copy left is the patched 2.4.0 that `@sentry/mcp-core` and
`@sentry/mcp-cloudflare` depend on directly.

The Worker's behavior stays the same as with Mastra 1.83.0 (what `main`
runs now): same MCP tools, same `/internal/docs` API, same outputs,
error messages, caching, span attributes, and metrics, and the same
requests to OpenRouter. The exceptions are four deliberate differences,
listed under [Accepted differences](#accepted-differences).

## What changed

- **`model-fallback.ts`**: `createNativeModelFallbacks()` now returns
one AI SDK model instead of a Mastra model list. On every model call it
tries the primary, then `FALLBACK_MODEL`, then `KIMI_FALLBACK_MODEL`,
with the same retries Mastra 1.83 did (see below). It sets
`response.modelId` to the model that answered, so `getUsedModelId` and
the `agent.model` span attribute keep working. When every model fails,
it throws the last model's error. Like Mastra 1.83, it drops
`temperature` for `openai/gpt-5.4`, which Mastra's provider registry
lists as not supporting it.
- **query and tailor agents**: `generateText` with `stopWhen:
stepCountIs(n)` and the same model settings. The last step sends the
tools with `toolChoice: "none"`. The tailor synthesis pass sends the
run's response messages plus the instruction, with the tools and
`toolChoice: "none"`, as Mastra 1.83 did.
- **features agent**: Mastra 1.83's structured-output handling is
reimplemented in `parseFeaturesOutput`. It asks for the JSON schema
response format on every step and only reads steps that have text, no
tool calls, and no error. It throws `Structured output was truncated
because the model finished with reason "length".` for a step that was
cut off. Otherwise it strips a `<|message|>` prefix or a ```` ```json
```` fence, pulls the last JSON object out of surrounding prose, escapes
raw control characters, repairs partial JSON, and throws `Structured
output validation failed: - path: message` on a schema mismatch.
- **`tools.ts`**: the tools keep Mastra's wire format. `minLength` moves
into the property description (`constraints: minimum length 1`), tool
results are sent with sorted keys, and invalid tool input comes back to
the model as Mastra's `{ error, message, validationErrors }` result. The
comment about Mastra vendoring AI SDK schema types is gone.
- Removed the `execa` Worker stub and its wrangler alias, which only
Mastra needed, and updated the README.

## Retry and fallback semantics

| | Mastra 1.83.0 | This PR |
| --- | --- | --- |
| Fallback order | Primary → `FALLBACK_MODEL` → Kimi, starting from the
primary on every step | Same |
| Retryable error (408, 409, 429, 5xx) on a model that isn't last |
Retry the same model, at most 2 retries per step across the chain | Same
|
| Retry delay | 3 s, or the provider's `Retry-After` / `Retry-After-Ms`
if longer, capped at 30 s | Same |
| Connection reset (`ECONNRESET`, "socket hang up") | 1 s, 2 s, …
backoff, capped at 30 s | Same |
| Non-retryable error (such as 400) | Next model right away | Same |
| Last model | Never retried, and its error is thrown | Same |
| AI SDK and per-model retries | Off (`maxRetries: 0`) | Off
(`maxRetries: 0`) |

Example: primary 503 three times, then the fallback 503 → primary,
primary +3 s, primary +6 s, fallback, Kimi.

The old comment said Mastra retried each model 3 times through p-retry.
In 1.83 the per-model `maxRetries: 0` turns p-retry off, and the retries
above come from Mastra's step-level retry instead. I replaced the
comment.

## Accepted differences

BYK reviewed these four differences from Mastra 1.83.0 and accepted them
as deliberate:

- **Token and step counts after a retry.** In Mastra 1.83, after a step
retries, the run reports 0 input and output tokens, and the retry counts
as an extra step. That's a bookkeeping bug. This PR reports the real
usage and step count, so `agent.tokens.*`, `agent.steps`, and their
metrics only differ in runs that retried.
- **Exception type.** Structured-output errors are a plain `Error`
instead of `MastraError`. The message is the same, but the Sentry issue
type changes.
- **Logs.** Mastra's own console logs ("Upstream LLM API error", "Error
in agent stream") are gone. Instead, one `[model-fallback] Error
executing model …` line is logged per failed attempt. The Worker doesn't
send console logs to Sentry.
- **Not ported.** Mastra heuristics that this Worker isn't expected to
trigger: rewriting message history for provider compatibility, assistant
prefill handling, and special handling for quota-error wording.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A78a950ae66477ad808a2d09a2706bf71 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A78a950ae66477ad808a2d09a2706bf71)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A78a950ae66477ad808a2d09a2706bf71/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 58a9740e Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant