MCPcopy Create free account
hub / github.com/chhoumann/quickadd / assertSecureDirIfPresent

Function assertSecureDirIfPresent

scripts/start-obsidian-e2e-instance.mjs:201–212  ·  view source on GitHub ↗
(dir, options = {})

Source from the content-addressed store, hash-verified

199// refuse a hijacked/symlinked root, but must not create one — a missing root
200// just means there is nothing to clean up. Returns false when the path is absent.
201export async function assertSecureDirIfPresent(dir, options = {}) {
202 const currentUid = resolveCurrentUid(options);
203 let stat;
204 try {
205 stat = await fs.lstat(dir);
206 } catch (error) {
207 if (error?.code === "ENOENT") return false;
208 throw error;
209 }
210 assertOwnedDir(dir, stat, currentUid);
211 return true;
212}
213
214export async function prepareObsidianProfile(options) {
215 // Fail closed if our profile tree is not a private directory we own

Callers 3

reapOrphanedInstancesFunction · 0.90
mainFunction · 0.90

Calls 2

resolveCurrentUidFunction · 0.85
assertOwnedDirFunction · 0.85

Tested by

no test coverage detected