Skip to content

fix(security): skip POSIX tmp-dir permission check on Windows - #191

Open
Snownamida wants to merge 1 commit into
TKasperczyk:mainfrom
Snownamida:fix/windows-tmp-perms-check
Open

fix(security): skip POSIX tmp-dir permission check on Windows#191
Snownamida wants to merge 1 commit into
TKasperczyk:mainfrom
Snownamida:fix/windows-tmp-perms-check

Conversation

@Snownamida

Copy link
Copy Markdown

Problem

On Windows the MCP server never starts: writeConnectionInfo throws "thunderbird-mcp tmp directory has group/world permissions — refusing to write connection info", so connection.json is never written and the bridge cannot discover the server.

Root cause

The POSIX hardening check in writeConnectionInfo reads nsIFile.permissions on the existing <TmpD>/thunderbird-mcp directory:

  • On Windows, nsIFile.permissions reports permissive pseudo-modes (group/world bits set) instead of 0, contradicting the in-code comment that "permissions is 0 on platforms that don't expose POSIX modes (Windows ACLs)".
  • The permissions setter (= 0o700) is a no-op on Windows, so the re-check always still sees group/world bits and the fatal throw fires on every start.

Fix

Skip the fatal check on Windows (Services.appinfo.OS !== "WINNT"). The best-effort chmod is retained for POSIX platforms. The connection file remains protected by O_EXCL creation (symlink/overwrite defense), localhost-only binding by default, and the per-session bearer token.

Reproduction

  • Windows 11, Thunderbird ESR 140.13.0, extension v0.7.4
  • Install the XPI, restart Thunderbird
  • Error console shows Failed to start MCP server: Error: thunderbird-mcp tmp directory has group/world permissions — refusing to write connection info
  • <TmpD>\thunderbird-mcp directory exists but connection.json is never written

🤖 Generated with Claude Code

nsIFile.permissions reports permissive pseudo-modes on Windows and the
setter is a no-op, so the group/world hardening check always throws and
the MCP server never starts (connection.json is never written).

Skip the fatal check on WINNT. The connection file remains protected by
O_EXCL creation, localhost-only binding, and the per-session bearer
token.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant