oh-my-adhd 0.2.15 → 0.2.16
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.
package/dist/mcp/lib/brain.js
CHANGED
|
@@ -12,6 +12,8 @@ const LOG_FILE = path.join(BRAIN_DIR, "logs", "brain.log");
|
|
|
12
12
|
const VERSION_FILE = path.join(BRAIN_DIR, "VERSION");
|
|
13
13
|
export const SCHEMA_VERSION = 1;
|
|
14
14
|
export const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
15
|
+
export const SENSITIVE_DIRS = [".ssh", ".aws", ".gnupg", ".kube", ".docker",
|
|
16
|
+
path.join(".config", "git"), path.join(".config", "gh")];
|
|
15
17
|
async function appendLog(level, msg) {
|
|
16
18
|
try {
|
|
17
19
|
const entry = `${new Date().toISOString()} [${level}] ${msg}\n`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { getThreads, getThread, getPages } from "../../lib/brain.js";
|
|
2
|
+
import { getThreads, getThread, getPages, SENSITIVE_DIRS } from "../../lib/brain.js";
|
|
3
3
|
import fs from "fs/promises";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import os from "os";
|
|
@@ -31,8 +31,6 @@ export function registerWikiExport(server) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
// Block writes into known sensitive dirs — use realpath for symlink safety
|
|
34
|
-
const SENSITIVE_DIRS = [".ssh", ".aws", ".gnupg", ".kube", ".docker",
|
|
35
|
-
path.join(".config", "git"), path.join(".config", "gh")];
|
|
36
34
|
const homeDir = os.homedir();
|
|
37
35
|
let realResolved = resolved;
|
|
38
36
|
try {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ensureBrainDirs, BRAIN_DIR, SCHEMA_VERSION, UUID_RE, withBrainLock } from "../../lib/brain.js";
|
|
2
|
+
import { ensureBrainDirs, BRAIN_DIR, SCHEMA_VERSION, UUID_RE, SENSITIVE_DIRS, withBrainLock } from "../../lib/brain.js";
|
|
3
3
|
import fs from "fs/promises";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import os from "os";
|
|
6
|
-
const SENSITIVE_DIRS = [".ssh", ".aws", ".gnupg", ".kube", ".docker",
|
|
7
|
-
path.join(".config", "git"), path.join(".config", "gh")];
|
|
8
6
|
const SLUG_RE = /^[a-z0-9가-힣][a-z0-9가-힣_-]{0,127}$/;
|
|
9
7
|
const MAX_CONTENT_BYTES = 5 * 1024 * 1024; // 5MB per thread
|
|
10
8
|
const MAX_ITEMS = 10000; // max threads or pages per import
|
|
@@ -167,6 +165,8 @@ export function registerWikiImport(server) {
|
|
|
167
165
|
const content = typeof page.content === "string" ? page.content : "";
|
|
168
166
|
if (!SLUG_RE.test(slug) || !content)
|
|
169
167
|
continue;
|
|
168
|
+
if (Buffer.byteLength(content, "utf-8") > MAX_CONTENT_BYTES)
|
|
169
|
+
continue;
|
|
170
170
|
const pageFile = path.join(pagesDir, `${slug}.md`);
|
|
171
171
|
const pageTmp = pageFile + ".tmp";
|
|
172
172
|
await fs.writeFile(pageTmp, content, "utf-8");
|
package/package.json
CHANGED