@hivemagnus/ardent 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { lstat, mkdir, open, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import Database from 'better-sqlite3';
|
|
6
6
|
import { parse } from 'dotenv';
|
|
@@ -62,8 +62,10 @@ export function assertContextIdle(database) {
|
|
|
62
62
|
}
|
|
63
63
|
async function ownedFile(path) {
|
|
64
64
|
const info = await lstat(path);
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const directory = await lstat(dirname(path));
|
|
66
|
+
if (!info.isFile() || info.isSymbolicLink() || info.uid !== process.getuid?.() || (info.mode & 0o022) !== 0
|
|
67
|
+
|| !directory.isDirectory() || directory.isSymbolicLink() || directory.uid !== process.getuid?.() || (directory.mode & 0o077) !== 0)
|
|
68
|
+
throw new Error('Maintenance requires owner-private profile state');
|
|
67
69
|
}
|
|
68
70
|
export async function exerciseContext(store, summarize, loaded, previousModule, continueContext) {
|
|
69
71
|
const session = store.session('context-acceptance', 'direct', 'synthetic-continuity');
|