aiterm-mcp 0.25.2 → 0.25.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.
Files changed (2) hide show
  1. package/dist/core.js +13 -3
  2. package/package.json +1 -1
package/dist/core.js CHANGED
@@ -1625,7 +1625,11 @@ function resolveAndValidateGrokAuth(srcHome) {
1625
1625
  try {
1626
1626
  fd = fs.openSync(authPath, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW | fs.constants.O_NONBLOCK);
1627
1627
  const st = fs.fstatSync(fd);
1628
- if (!st.isFile() || st.nlink !== 1 || st.uid !== currentUid() || (st.mode & 0o077) !== 0 || st.size > GROK_AUTH_MAX_BYTES) {
1628
+ // Windows の fs.Stats.mode は POSIX permission bit を持たず、常に 666/777 相当を報告する
1629
+ // (NTFS ACL は別体系)。currentUid と同じ既知制約の明示的受容として、Windows では
1630
+ // group/other bit 検証を行わない。isFile・nlink・owner・size・O_NOFOLLOW・realpath 検証は共通に維持する。
1631
+ const worldAccessible = !isWin && (st.mode & 0o077) !== 0;
1632
+ if (!st.isFile() || st.nlink !== 1 || st.uid !== currentUid() || worldAccessible || st.size > GROK_AUTH_MAX_BYTES) {
1629
1633
  throw new AitermError("Grok 認証正本の安全検証に失敗しました", 2);
1630
1634
  }
1631
1635
  const value = JSON.parse(fs.readFileSync(fd, "utf8"));
@@ -1643,7 +1647,8 @@ function resolveAndValidateGrokAuth(srcHome) {
1643
1647
  // /tmp のような root 所有 + sticky の共有 directory は、本人所有の private な
1644
1648
  // 直下 directory を他 UID が rename/unlink できないため許可する。sticky 無しの
1645
1649
  // group/other writable 祖先は path swap が可能なので従来どおり拒否する。
1646
- const writableByOthers = (dirSt.mode & 0o022) !== 0;
1650
+ // Windows は directory も mode bit を持たない(常に 777 相当)ため、同じ受容で除外する。
1651
+ const writableByOthers = !isWin && (dirSt.mode & 0o022) !== 0;
1647
1652
  const protectedSharedRoot = dirSt.uid === 0 && (dirSt.mode & 0o1000) !== 0;
1648
1653
  if (!dirSt.isDirectory()
1649
1654
  || dirSt.isSymbolicLink()
@@ -4234,8 +4239,13 @@ function agentEnvPrefix(meta, sid, envVars = []) {
4234
4239
  if (meta.kind === "codex") {
4235
4240
  return common.join(" ") + " ";
4236
4241
  }
4242
+ // Windows では起動コマンドが WSL 内 bash で走るため、検証済み auth 正本の Windows ドライブパスを
4243
+ // bin/cwd と同じく /mnt/c/... 形へ変換して渡す。変換しないと WSL 側 grok が正本を開けず接続で停止する。
4244
+ const grokAuthForCmd = meta.grok_auth_path && isWin && isWindowsDrivePath(meta.grok_auth_path)
4245
+ ? toWslPath(meta.grok_auth_path)
4246
+ : meta.grok_auth_path;
4237
4247
  return [
4238
- ...(meta.grok_auth_path ? [`GROK_AUTH_PATH=${shq(meta.grok_auth_path)}`] : []),
4248
+ ...(grokAuthForCmd ? [`GROK_AUTH_PATH=${shq(grokAuthForCmd)}`] : []),
4239
4249
  "GROK_DISABLE_AUTOUPDATER=1",
4240
4250
  ...common,
4241
4251
  ].join(" ") + " ";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "mcpName": "io.github.kitepon/aiterm-mcp",
5
5
  "description": "Persistent tmux terminal MCP for launching and driving Claude, Codex, Grok, or Composer from any MCP client, cross-vendor or same-vendor. Also runs durable PTY sessions for SSH, containers, and REPLs.",
6
6
  "keywords": [