Skip to content

Commit a8fe8b6

Browse files
committed
test(guardrails): exclude suite files and harden auth temp identity naming
1 parent 82f01d6 commit a8fe8b6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/gateway/server.auth.shared.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { randomUUID } from "node:crypto";
12
import os from "node:os";
23
import path from "node:path";
34
import { expect } from "vitest";
@@ -288,7 +289,7 @@ async function startRateLimitedTokenServerWithPairedDeviceToken() {
288289
const { server, ws, port, prevToken } = await startServerWithClient();
289290
const deviceIdentityPath = path.join(
290291
os.tmpdir(),
291-
`openclaw-auth-rate-limit-${Date.now()}-${Math.random().toString(36).slice(2)}.json`,
292+
"openclaw-auth-rate-limit-" + randomUUID() + ".json",
292293
);
293294
try {
294295
const initial = await connectReq(ws, { token: "secret", deviceIdentityPath });
@@ -322,7 +323,7 @@ async function ensurePairedDeviceTokenForCurrentIdentity(ws: WebSocket): Promise
322323

323324
const deviceIdentityPath = path.join(
324325
os.tmpdir(),
325-
`openclaw-auth-device-${Date.now()}-${Math.random().toString(36).slice(2)}.json`,
326+
"openclaw-auth-device-" + randomUUID() + ".json",
326327
);
327328

328329
const res = await connectReq(ws, { token: "secret", deviceIdentityPath });

src/test-utils/runtime-source-guardrail-scan.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const DEFAULT_GUARDRAIL_SKIP_PATTERNS = [
1313
/\.test-helpers\.tsx?$/,
1414
/\.test-utils\.tsx?$/,
1515
/\.test-harness\.tsx?$/,
16+
/\.suite\.tsx?$/,
1617
/\.e2e\.tsx?$/,
1718
/\.d\.ts$/,
1819
/[\\/](?:__tests__|tests|test-utils)[\\/]/,

0 commit comments

Comments
 (0)