Skip to content

Commit c36b45a

Browse files
authored
Apply suggestions from code review
1 parent 4de6535 commit c36b45a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/mcp_agent/cli/auth/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ def save_credentials(credentials: UserCredentials) -> None:
2020

2121
# Create file with restricted permissions (0600) to prevent leakage
2222
with open(credentials_path, "w", encoding="utf-8") as f:
23-
f.write(credentials.to_json())
24-
os.chmod(credentials_path, 0o600)
23+
fd = os.open(credentials_path, os.O_WRONLY | os.O_CREAT, 0o600)
24+
with os.fdopen(fd, "w") as f:
25+
f.write(credentials.to_json())
2526

2627

2728
def load_credentials() -> Optional[UserCredentials]:

0 commit comments

Comments
 (0)