fix(diagnostics): scrub whole passwords; unique bundle names; no temporary files left behind
- A secret value runs to the next ';' or the end of the line unless quoted (backslash and doubled-quote escapes), so passwords with spaces, commas or quotes never leak in part; URL passwords run to the last '@' before the path. - Desktop bundles get " (2)", " (3)"… instead of overwriting one made in the same minute, and a bundle that fails half-way deletes its .tmp file. - The server builds its bundle in a temporary file that no crash leaves behind (DeleteOnClose on Windows, unlinked at once elsewhere). - Tests: passwords with spaces, commas, quotes and '@'; a DbConnectionString in the server bundle; bundle name collisions and failure cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
6 files changed
+95
-27
No files matched your search
@@ -33,8 +33,13 @@ public static class DiagnosticsEndpoints
|
||||
var settings = JsonSerializer.Serialize(options, ServerOptionsJson.Default.ServerOptions);
|
||||
var encoders = Encoders(services.GetService<ProcessingService>());
|
||||
|
||||
// The bundle is built in a self-deleting temporary file: zip writes are synchronous and logs can be large.
|
||||
var file = new FileStream(Path.GetTempFileName(), FileMode.Create, FileAccess.ReadWrite, FileShare.None, 1 << 16, FileOptions.DeleteOnClose);
|
||||
// The bundle is built in a temporary file (zip writes are synchronous and logs can be large) that no crash leaves
|
||||
// behind: Windows deletes it when the handle closes; elsewhere it is unlinked at once and lives on through the
|
||||
// open handle (DeleteOnClose there would unlink by name at close, possibly a newer file of the same name).
|
||||
var temp = Path.GetTempFileName();
|
||||
var file = new FileStream(temp, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 1 << 16,
|
||||
OperatingSystem.IsWindows() ? FileOptions.DeleteOnClose : FileOptions.None);
|
||||
if (!OperatingSystem.IsWindows()) File.Delete(temp);
|
||||
try
|
||||
{
|
||||
await Task.Run(() =>
|
||||
|
||||
Reference in new issue
Block a user