Skip to content

Commit 0c75715

Browse files
Merge pull request #951 from jsonwebtoken/fix/next-security-upgrade
fix: NextJS security upgrade.
2 parents 5098c53 + e560203 commit 0c75715

35 files changed

Lines changed: 4632 additions & 2980 deletions

‎.eslintrc.json‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎.github/workflows/tests.yaml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ on:
77
branches: [master]
88

99
jobs:
10+
quality:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '22'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run ESLint
24+
run: npm run lint
25+
26+
- name: Check types
27+
run: npm run typecheck
28+
29+
- name: Build
30+
run: npm run build
31+
1032
test:
1133
runs-on: ubuntu-latest
1234
steps:

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ yarn-error.log*
3737

3838
.npmrc
3939
**/.npmrc
40+
.npmrc.oidc
4041

4142

4243
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,visualstudiocode,webstorm,intellij,node

‎eslint.config.mjs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
2+
3+
const config = [
4+
...nextCoreWebVitals,
5+
{
6+
// Both rules target the Pages Router; this is the App Router root layout,
7+
// which renders <head> itself and loads the font stylesheet per-locale.
8+
files: ["src/features/common/components/layout/page-layout/**"],
9+
rules: {
10+
"@next/next/no-head-element": "off",
11+
"@next/next/no-css-tags": "off",
12+
},
13+
},
14+
];
15+
16+
export default config;

‎next-env.d.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
import "./.next/types/routes.d.ts";
4+
import "./.next/types/root-params.d.ts";
35

46
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
7+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

‎next.config.mjs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import createMDX from "@next/mdx";
22

33
/** @type {import('next').NextConfig} */
44
const nextConfig = {
5+
// Next 16 writes AGENTS.md/CLAUDE.md on `next dev`; keep them out of the tree.
6+
agentRules: false,
57
// Playwright runs both browser projects against one long-lived dev server.
68
// Retain route entries so later Firefox tests do not reference evicted chunks.
79
...(process.env.CI
@@ -34,6 +36,23 @@ const nextConfig = {
3436
}
3537
);
3638

39+
// @next/mdx registers its loader without an App Router layer, so .mdx misses
40+
// Next's React aliasing and dev crashes on "ReactCurrentDispatcher of undefined".
41+
const mdxRule = config.module.rules.find(
42+
(rule) => rule?.test?.toString() === /\.mdx$/.toString()
43+
);
44+
45+
if (mdxRule) {
46+
mdxRule.resolve = {
47+
...mdxRule.resolve,
48+
alias: {
49+
...mdxRule.resolve?.alias,
50+
"react/jsx-runtime": "next/dist/compiled/react/jsx-runtime",
51+
"react/jsx-dev-runtime": "next/dist/compiled/react/jsx-dev-runtime",
52+
},
53+
};
54+
}
55+
3756
return config;
3857
},
3958
images: {

0 commit comments

Comments
 (0)