Skip to content

fix(server): skip Unix-only permission check on Windows for server token - #1135

Merged
wbxl2000 merged 1 commit into
mainfrom
fix/windows-token-permission-check
Jun 26, 2026
Merged

fix(server): skip Unix-only permission check on Windows for server token#1135
wbxl2000 merged 1 commit into
mainfrom
fix/windows-token-permission-check

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Problem

On Windows, Node.js synthesizes Unix-style file modes from the read-only attribute, so a normal writable private file is reported as mode 666. The server token read path rejected this as too permissive, expecting mode 0600. Because Windows has no equivalent of Unix owner/group/other permission bits, this check always fails on Windows once server.token exists on disk.

This caused the server/daemon to fail to start after the first run (e.g. after a reboot), breaking kimi web on Windows.

What changed

  • readPrivateFile now skips the (mode & 0o077) !== 0 check on win32.
  • tokenStore.currentToken() skips the same check on Windows so live token rotation still works.
  • Updated services-auth.test.ts to run cross-platform round-trip/reuse tests on Windows and keep the Unix-only mode assertions skipped on Windows.

Checklist

  • I have read the CONTRIBUTING document.
  • I have explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.

@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d7d6170

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/server Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 26, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@d7d6170
npx https://pkg.pr.new/@moonshot-ai/kimi-code@d7d6170

commit: d7d6170

@wbxl2000
wbxl2000 merged commit bf51fb7 into main Jun 26, 2026
10 checks passed
@wbxl2000
wbxl2000 deleted the fix/windows-token-permission-check branch June 26, 2026 10:38
@github-actions github-actions Bot mentioned this pull request Jun 26, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Jul 11, 2026
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