Is your feature request related to a problem?
SecureWriteFile in config/encryption.go writes directly to the target path. If the process crashes during the write, the file could be left in a corrupted or truncated state.
Describe the solution you'd like
Use an "atomic" write pattern: write to a temporary file first, then use os.Rename to move it to the final destination.
Describe alternatives you've considered
N/A
Additional context
This should be applied to SecureWriteFile and potentially regular os.WriteFile calls for important data.
Is your feature request related to a problem?
SecureWriteFileinconfig/encryption.gowrites directly to the target path. If the process crashes during the write, the file could be left in a corrupted or truncated state.Describe the solution you'd like
Use an "atomic" write pattern: write to a temporary file first, then use
os.Renameto move it to the final destination.Describe alternatives you've considered
N/A
Additional context
This should be applied to
SecureWriteFileand potentially regularos.WriteFilecalls for important data.