You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Server] Write the generated private key atomically #2366
Is your feature request related to a problem? Please describe.
When server.token-signing-private-key-file is not set, the server generates its key in the configuration folder on first start (deprecated since #2081). writeOwnerOnly writes private_key.der by deleting the file, creating it readable by its owner only, and then writing the key. If the process stops between the create and the write, an empty private_key.der is left next to public_key.der. The next start sees both files, does not generate a new key, and fails to read the empty one, until someone removes it.
It fails closed, the window is short, and it only affects the deprecated key-folder path.
Write the key to a temporary file in the same folder, created readable by its owner only, then move it into place with Files.move(..., StandardCopyOption.ATOMIC_MOVE).
Activity