Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/producer/src/services/deterministicFonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,13 @@
function fontCacheDir(slug: string): string {
const dir = join(resolveFontCacheRoot(), slug);
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
try {
mkdirSync(dir, { recursive: true });
} catch {
const fallback = join(tmpdir(), `hyperframes-fonts-fallback`, slug);
mkdirSync(fallback, { recursive: true });
return fallback;
}
}
return dir;
}
Expand Down Expand Up @@ -1047,7 +1053,7 @@
if (!fontResult.ok) return null;
// wx = O_CREAT|O_EXCL: atomic create, rejects symlinks, fails with
// EEXIST if a concurrent call cached it between our read and write.
writeFileSync(cachePath, Buffer.from(fontResult.body), { flag: "wx", mode: 0o644 });

Check failure

Code scanning / CodeQL

Insecure temporary file High

Insecure creation of file in
the os temp dir
.
} catch (err) {
throwIfCallerAborted(options.abortSignal);
if (err instanceof FontFetchError) throw err;
Expand Down
Loading