(dir, options = {})
| 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. |
| 201 | export 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 | |
| 214 | export async function prepareObsidianProfile(options) { |
| 215 | // Fail closed if our profile tree is not a private directory we own |
no test coverage detected