fix(security): avoid rendering error stacks (#5624)

Integrated into release/v3.8.43 (drift-shed: cherry-picked the real change onto the release tip; stale-base drift dropped).
This commit is contained in:
KooshaPari
2026-06-30 06:40:58 -07:00
committed by GitHub
parent d97734a749
commit 4aae3eec22
2 changed files with 12 additions and 1 deletions

View File

@@ -40,7 +40,6 @@ export default function Error({ error, reset }: ErrorProps) {
aria-label="Error details"
>
{error.message}
{error.stack && `\n\n${error.stack}`}
</pre>
)}
<div className="flex gap-3">

View File

@@ -0,0 +1,12 @@
import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
const repoRoot = join(import.meta.dirname, "../..");
test("app error boundary does not render stack traces", async () => {
const source = await readFile(join(repoRoot, "src/app/error.tsx"), "utf8");
assert.doesNotMatch(source, /error\.stack/);
});