2 Commits

Author SHA1 Message Date
lukiod
255e00b19c fix: create auth secret and token files with owner only permissions
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.
2026-07-27 22:08:26 +05:30
Bingxi Zhao (Frank)
c9d387e2b6 super super great great update 2026-06-17 00:56:27 +08:00