companionbot 0.4.2 → 0.4.3
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/tools/index.js +22 -3
- package/package.json +1 -1
package/dist/tools/index.js
CHANGED
|
@@ -49,13 +49,32 @@ function appendOutput(session, data) {
|
|
|
49
49
|
}
|
|
50
50
|
// 홈 디렉토리
|
|
51
51
|
const home = process.env.HOME || "";
|
|
52
|
-
// 허용된 디렉토리
|
|
52
|
+
// 허용된 디렉토리 설정
|
|
53
|
+
// - COMPANIONBOT_FULL_ACCESS=true: 홈 디렉토리 전체 접근 (위험한 파일 패턴은 여전히 차단)
|
|
54
|
+
// - COMPANIONBOT_ALLOWED_PATHS: 콜론(:)으로 구분된 추가 경로 (예: /tmp:/var/data)
|
|
55
|
+
// - 기본값: ~/Documents, ~/projects, 워크스페이스
|
|
53
56
|
function getAllowedPaths() {
|
|
54
|
-
|
|
57
|
+
// 전체 접근 모드
|
|
58
|
+
if (process.env.COMPANIONBOT_FULL_ACCESS === "true") {
|
|
59
|
+
return [home];
|
|
60
|
+
}
|
|
61
|
+
// 기본 경로
|
|
62
|
+
const paths = [
|
|
55
63
|
path.join(home, "Documents"),
|
|
56
64
|
path.join(home, "projects"),
|
|
57
|
-
getWorkspacePath(),
|
|
65
|
+
getWorkspacePath(),
|
|
58
66
|
];
|
|
67
|
+
// 환경변수로 추가 경로 설정
|
|
68
|
+
const extraPaths = process.env.COMPANIONBOT_ALLOWED_PATHS;
|
|
69
|
+
if (extraPaths) {
|
|
70
|
+
const extras = extraPaths.split(":").filter(p => p.trim());
|
|
71
|
+
for (const p of extras) {
|
|
72
|
+
// ~ 확장
|
|
73
|
+
const expanded = p.startsWith("~") ? path.join(home, p.slice(1)) : p;
|
|
74
|
+
paths.push(expanded);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return paths;
|
|
59
78
|
}
|
|
60
79
|
// 위험한 파일 패턴
|
|
61
80
|
// SSRF 방지: 사설 IP 체크
|