Skip to content

Autonomous AI sales agent powered by Claude Code or Codex. Finds prospects, writes cold emails, sends campaigns, handles replies, books meetings. No API keys needed — runs on your Claude or Codex subscriptions.

Make Microsoft token permission assertion platform-aware

Ethanfed594f41166
diff --git a/docs/microsoft365.md b/docs/microsoft365.md
index 3af4585..5639f01 100644
--- a/docs/microsoft365.md
+++ b/docs/microsoft365.md
@@ -69,7 +69,10 @@ Harvey asks for four **delegated** permissions:
| `User.Read` | check which mailbox the token belongs to |
| `offline_access` | keep working without signing in again |
-The refresh token is stored in `data/m365_token.json` (mode 600, gitignored).
+The refresh token is stored in `data/m365_token.json` (gitignored). On macOS
+and Linux the file is mode 600 (owner only). Windows has no such mode bits:
+the file is protected only by the access permissions (ACLs) of the folder
+Harvey lives in, so keep Harvey in a folder only you can read.
Microsoft rotates it on every use, and Harvey saves the new one each time.
### If you see "Need admin approval"
diff --git a/tests/test_microsoft.py b/tests/test_microsoft.py
index 2426399..1c92667 100644
--- a/tests/test_microsoft.py
+++ b/tests/test_microsoft.py
@@ -2,6 +2,7 @@
reading the inbox without touching it, and failing loudly."""
import json
+import os
import httpx
import pytest
@@ -118,7 +119,8 @@ async def test_refresh_token_rotates_and_is_saved(graph):
assert "client_secret" not in form # public client
saved = json.loads(microsoft.TOKEN_FILE.read_text())
assert saved["refresh_token"] == "rt-2"
- assert microsoft.TOKEN_FILE.stat().st_mode & 0o777 == 0o600
+ if os.name == "posix": # Windows has no POSIX mode bits; ACLs apply
+ assert microsoft.TOKEN_FILE.stat().st_mode & 0o777 == 0o600
@pytest.mark.asyncio