Skip to content

Commit 0a9e2db

Browse files
committed
permissions on credentials dir
1 parent 47c9c99 commit 0a9e2db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/mcp_agent/cli/auth/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ def save_credentials(credentials: UserCredentials) -> None:
1616
None
1717
"""
1818
credentials_path = os.path.expanduser(DEFAULT_CREDENTIALS_PATH)
19-
os.makedirs(os.path.dirname(credentials_path), exist_ok=True)
19+
cred_dir = os.path.dirname(credentials_path)
20+
os.makedirs(cred_dir, exist_ok=True)
21+
try:
22+
os.chmod(cred_dir, 0o700)
23+
except OSError:
24+
pass
2025

2126
# Create file with restricted permissions (0600) to prevent leakage
2227
fd = os.open(credentials_path, os.O_WRONLY | os.O_CREAT, 0o600)

0 commit comments

Comments
 (0)