oh-my-adhd 0.2.25 → 0.2.27
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 +12 -1
- package/dist/mcp/mcp/tools/wiki-import.js +16 -18
- package/package.json +4 -4
package/dist/mcp/lib/brain.js
CHANGED
|
@@ -14,6 +14,11 @@ 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
15
|
export const SENSITIVE_DIRS = [".ssh", ".aws", ".gnupg", ".kube", ".docker",
|
|
16
16
|
path.join(".config", "git"), path.join(".config", "gh")];
|
|
17
|
+
// Absolute system paths that are sensitive regardless of home dir location
|
|
18
|
+
const SYSTEM_SENSITIVE_DIRS = [
|
|
19
|
+
path.join("/", "root", ".ssh"), path.join("/", "root", ".aws"),
|
|
20
|
+
path.join("/", "etc", "ssh"), path.join("/", "etc", "ssl"),
|
|
21
|
+
];
|
|
17
22
|
export async function isSensitivePath(filePath) {
|
|
18
23
|
const homeDir = os.homedir();
|
|
19
24
|
let realDir = path.dirname(filePath);
|
|
@@ -23,7 +28,13 @@ export async function isSensitivePath(filePath) {
|
|
|
23
28
|
catch { /* dir may not exist yet */ }
|
|
24
29
|
const realHome = await fs.realpath(homeDir).catch(() => homeDir);
|
|
25
30
|
const rel = path.relative(realHome, realDir).toLowerCase();
|
|
26
|
-
|
|
31
|
+
// Home-relative denylist
|
|
32
|
+
if (SENSITIVE_DIRS.some(d => rel === d.toLowerCase() || rel.startsWith(d.toLowerCase() + path.sep)))
|
|
33
|
+
return true;
|
|
34
|
+
// Absolute denylist for paths outside home (e.g. /root/.ssh, /etc/ssl)
|
|
35
|
+
if (SYSTEM_SENSITIVE_DIRS.some(d => realDir === d || realDir.startsWith(d + path.sep)))
|
|
36
|
+
return true;
|
|
37
|
+
return false;
|
|
27
38
|
}
|
|
28
39
|
async function appendLog(level, msg) {
|
|
29
40
|
try {
|
|
@@ -25,25 +25,23 @@ export function registerWikiImport(server) {
|
|
|
25
25
|
isError: true,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
//
|
|
29
|
-
try {
|
|
30
|
-
const stat = await fs.stat(resolved);
|
|
31
|
-
if (stat.size > 100 * 1024 * 1024) {
|
|
32
|
-
return {
|
|
33
|
-
content: [{ type: "text", text: "오류: 파일이 너무 큽니다 (100MB 초과)." }],
|
|
34
|
-
isError: true,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return {
|
|
40
|
-
content: [{ type: "text", text: `오류: 파일을 읽을 수 없습니다: ${resolved}` }],
|
|
41
|
-
isError: true,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
28
|
+
// Open once so stat + read refer to the same inode (closes TOCTOU window)
|
|
44
29
|
let raw;
|
|
45
30
|
try {
|
|
46
|
-
|
|
31
|
+
const handle = await fs.open(resolved, "r");
|
|
32
|
+
try {
|
|
33
|
+
const stat = await handle.stat();
|
|
34
|
+
if (stat.size > 100 * 1024 * 1024) {
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: "text", text: "오류: 파일이 너무 큽니다 (100MB 초과)." }],
|
|
37
|
+
isError: true,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
raw = await handle.readFile({ encoding: "utf-8" });
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
await handle.close();
|
|
44
|
+
}
|
|
47
45
|
}
|
|
48
46
|
catch {
|
|
49
47
|
return {
|
|
@@ -126,7 +124,7 @@ export function registerWikiImport(server) {
|
|
|
126
124
|
id,
|
|
127
125
|
title,
|
|
128
126
|
updatedAt: typeof thread.updatedAt === "string" && Number.isFinite(Date.parse(thread.updatedAt))
|
|
129
|
-
? thread.updatedAt
|
|
127
|
+
? new Date(thread.updatedAt).toISOString()
|
|
130
128
|
: new Date().toISOString(),
|
|
131
129
|
};
|
|
132
130
|
if (typeof thread.is_open === "boolean")
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-adhd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.27",
|
|
4
4
|
"description": "ADHD second brain — zero-friction capture, auto context restore, unstick. MCP-native Claude Code plugin.",
|
|
5
5
|
"author": "Haechan Jeong",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/gocks77777/oh-my-adhd.git"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://github.com/
|
|
10
|
+
"homepage": "https://github.com/gocks77777/oh-my-adhd#readme",
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/gocks77777/oh-my-adhd/issues"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"claude",
|