mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:38:27 +00:00
refactor(security): unify secure id paths and guard weak patterns
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
@@ -49,10 +50,7 @@ export function makeRuntime(params?: { throwOnError?: boolean }): {
|
||||
}
|
||||
|
||||
export function writeStore(data: unknown, prefix = "sessions"): string {
|
||||
const file = path.join(
|
||||
os.tmpdir(),
|
||||
`${prefix}-${Date.now()}-${Math.random().toString(16).slice(2)}.json`,
|
||||
);
|
||||
const file = path.join(os.tmpdir(), `${prefix}-${Date.now()}-${randomUUID()}.json`);
|
||||
fs.writeFileSync(file, JSON.stringify(data, null, 2));
|
||||
return file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user