mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 07:59:47 +08:00
Three sites wrote secrets with Path.write_text and narrowed them with chmod afterwards. write_text creates using 0o666 & ~umask, so the contents were readable by other local users until the chmod landed, and permanently whenever it raised, since the error was discarded. Affected: the auth secret in multi_user/identity.py, minted with secrets.token_hex(32) and written world readable at creation, the same file on the legacy migration path, and the skill hub tokens in services/skill/credentials.py. write_secret_text passes the mode to os.open so it applies at creation. The parent directory is created 0700, and a leftover from an interrupted run is replaced rather than truncated. Measured on Linux under the default umask: 0644 holding the secret before being narrowed to 0600.