MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / restrictDbFilePermissions

Function restrictDbFilePermissions

apps/local/src/db/libsql.ts:41–53  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

39 * mount, must not stop the server booting over a permission it cannot set.
40 */
41const restrictDbFilePermissions = (path: string): void => {
42 if (path === ":memory:") return;
43 const base = resolve(path);
44 for (const suffix of DB_FILE_SUFFIXES) {
45 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: chmod on a file that may not exist yet or a filesystem without POSIX modes; hardening must never block boot
46 try {
47 chmodSync(`${base}${suffix}`, 0o600);
48 } catch {
49 // Sidecars only exist once WAL has been used, and not every filesystem
50 // supports chmod. Either way the open proceeds.
51 }
52 }
53};
54
55/**
56 * Open a libSQL client for a local on-disk DB and apply the per-connection

Callers 1

openLocalLibsqlFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected