unsloth/studio/backend/auth
Daniel Han 9a21e8fbef Make the bootstrap normalisation append-only
clear_bootstrap_password() falls back to truncating the file through its own
descriptor when the unlink fails, which is what happens on Windows while this
one is open. That truncation could land after the equality check and before the
write, so the rewrite put the revoked plaintext back.

Append a single LF instead, and only to a file that is exactly the credential.
An append cannot restore a revoked secret: over a cleared file the result is a
lone newline, which strips to empty and reads back as no bootstrap password.
Releases before the newline wrote the password with no terminator at all, so
that is the only shape in the wild; anything else is left alone and keeps
working because every reader strips.

Never truncating also removes the short-write NUL-fill hazard entirely, so the
write loop is gone. O_BINARY stays: without it Windows would turn the appended
LF into CRLF.
2026-07-29 07:29:39 +00:00
..
.gitkeep root studio folder 2026-02-02 09:13:49 +00:00
__init__.py Studio: make code comments and docstrings more succinct (#6029) 2026-06-08 23:07:28 -07:00
authentication.py Studio: tighten the comments added by the OpenAI model-admission work (#7501) 2026-07-27 05:59:03 -07:00
bootstrap_timeout.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
hashing.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
storage.py Make the bootstrap normalisation append-only 2026-07-29 07:29:39 +00:00
terminal_prompt.py Studio: reject whitespace-only passwords (#7341) 2026-07-23 00:44:37 -07:00