From af550fb2a48ffd462bce25be3882c6ab4b6e2eef Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 09:29:29 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20CodeRabbit=20CI=20Fix:=20Fix=20S?= =?UTF-8?q?tatic=20PR=20Checks=20and=20Gitleaks=20CI=20Failures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/client-secret-surface.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/client-secret-surface.test.ts b/tests/client-secret-surface.test.ts index 8f911214c..6274bac46 100644 --- a/tests/client-secret-surface.test.ts +++ b/tests/client-secret-surface.test.ts @@ -175,14 +175,18 @@ describe("client environment isolation", () => { // check client-side; that literal alone must not trip the scanner. writeFileSync( join(staticRoot, "sdk-prefix-check.js"), - "const isNewApiKey = (key) => key.startsWith(\"sb_publishable_\") || key.startsWith(\"sb_secret_\");", + 'const isNewApiKey = (key) => key.startsWith("sb_publishable_") || key.startsWith("sb_secret_");', "utf8", ); const prefixOnlyResult = spawnSync(process.execPath, [scannerPath], { cwd: fixtureRoot, encoding: "utf8" }); expect(prefixOnlyResult.status).toBe(0); rmSync(join(staticRoot, "sdk-prefix-check.js")); - writeFileSync(join(staticRoot, "leaked-key.js"), "const key = 'sb_secret_abc123DEF456';", "utf8"); + // Built via concatenation so this fixture's synthetic, non-functional key + // never appears as a contiguous literal in this test's own source (which + // would otherwise look like a real leaked secret to git secret scanners). + const fakeSecretKey = ["sb_secret_", "abc123DEF456"].join(""); + writeFileSync(join(staticRoot, "leaked-key.js"), `const key = '${fakeSecretKey}';`, "utf8"); const leakedKeyResult = spawnSync(process.execPath, [scannerPath], { cwd: fixtureRoot, encoding: "utf8" }); expect(leakedKeyResult.status).toBe(1); expect(leakedKeyResult.stderr).toContain(".next/static/leaked-key.js");