Skip to content

Commit ed60af7

Browse files
authored
fix(nuxt): dev dependency security fixes - bump nuxt to 3.21.11 (#23235)
The update requires a small change in the code to remove the type errors (it's not breaking). Nuxt moved Nitro-specific types out of `@nuxt/schema` and into module augmentations provided by `@nuxt/nitro-server`: - nuxt/nuxt#34039 The hooks remain supported and documented, but TypeScript only applies these augmentations when the package containing them is included in the TypeScript program. That's why an empty type-only import is needed now. Fixes GHSA-hxcr-hm88-mpq6 / CVE-2026-71314 (high) — https://github.com/getsentry/sentry-javascript/security/dependabot/2377
1 parent d61bdad commit ed60af7

7 files changed

Lines changed: 1659 additions & 1096 deletions

File tree

packages/nuxt/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
"local-pkg": "^1.1.2"
6666
},
6767
"devDependencies": {
68-
"@nuxt/nitro-server": "^3.21.6",
68+
"@nuxt/nitro-server": "^3.21.11",
6969
"nitro": "^3.0.260311-beta",
7070
"nuxi": "^3.25.1",
71-
"nuxt": "3.17.7",
71+
"nuxt": "3.21.11",
7272
"vite": "^6.4.3"
7373
},
7474
"scripts": {

packages/nuxt/src/module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import {
77
createResolver,
88
defineNuxtModule,
99
} from '@nuxt/kit';
10+
// Needed to make TS evaluate the augmentation of Nitro types (https://github.com/nuxt/nuxt/pull/34039)
11+
import type {} from '@nuxt/nitro-server';
12+
1013
import { consoleSandbox } from '@sentry/core';
1114
import * as path from 'path';
1215
import type { SentryNuxtModuleOptions } from './common/types';

packages/nuxt/src/runtime/plugins/sentry-cloudflare.server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ export const sentryCloudflareNitroPlugin =
102102

103103
nitroApp.hooks.hook('beforeResponse', updateRouteBeforeResponse);
104104

105-
// @ts-expect-error - 'render:html' is a valid hook name in the Nuxt context
106105
nitroApp.hooks.hook('render:html', (html: NuxtRenderHTMLContext, { event }: { event: H3Event }) => {
107106
let storedTraceData: ReturnType<typeof getTraceData> | undefined = undefined;
108107

packages/nuxt/src/runtime/plugins/sentry.client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ export default defineNuxtPlugin({
6767

6868
nuxtApp.hook('app:error', error => {
6969
if (isNuxtError(error)) {
70+
// oxlint-disable-next-line typescript/no-deprecated
71+
const statusCode = error?.status || error?.statusCode;
72+
7073
// Do not report if status code is 3xx or 4xx
71-
if (error?.statusCode && error.statusCode >= 300 && error.statusCode < 500) {
74+
if (statusCode && statusCode >= 300 && statusCode < 500) {
7275
return;
7376
}
7477
}

packages/nuxt/src/runtime/plugins/sentry.server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { addSentryTracingMetaTags } from '../utils';
88
export default (nitroApp => {
99
nitroApp.hooks.hook('error', sentryCaptureErrorHook);
1010

11-
// @ts-expect-error - 'render:html' is a valid hook name in the Nuxt context
1211
nitroApp.hooks.hook('render:html', (html: NuxtRenderHTMLContext, { event }: { event: H3Event }) => {
1312
// h3 v1 (Nuxt 4): event.node.res.getHeaders(); h3 v2 (Nuxt 5): event.node is undefined
1413
const nodeResHeadersH3v1 = event.node?.res?.getHeaders() || {};

packages/nuxt/tsconfig.test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
"compilerOptions": {
77
// should include all types from `./tsconfig.json` plus types for all test frameworks used
8-
"types": ["node"]
8+
"types": ["node", "@nuxt/nitro-server"]
99
}
1010
}

yarn.lock

Lines changed: 1649 additions & 1090 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)