From 84f56bf5175f93194f03f9819f6b9a62f492b9ad Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 24 Oct 2026 19:01:21 -0500 Subject: remove ability to dump memory at run-time --- .../Core/API/Controllers/ApplicationController.cs | 21 --------------------- src/slskd/Core/Options.cs | 13 ------------- 2 files changed, 34 deletions(-) (limited to 'src/slskd/Core') diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index c9af1296..e015e612 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -167,27 +167,6 @@ namespace slskd.Core.API return Ok(); } - [ApiExplorerSettings(IgnoreApi = true)] - [HttpGet("dump")] - [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] - public async Task DumpMemory() - { - if (OptionsAtStartup.Flags.Dumpable) - { - Log.Warning("Dumping application memory..."); - - using var dumper = new Dumper(); - var file = await dumper.DumpAsync(); - - Log.Warning("Dump complete"); - - return PhysicalFile(file, "application/octet-stream", "slskd.dmp"); - } - - Log.Warning("Unauthorized attempt to dump application memory; Flags.Dumpable is disabled"); - return Forbid(); - } - [ApiExplorerSettings(IgnoreApi = true)] [HttpPost("loopback")] [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index d2aba37f..05eaed57 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -483,19 +483,6 @@ namespace slskd [RequiresRestart] public bool Volatile { get; init; } = false; - /// - /// Gets a value indicating whether real-time memory dumping via API is enabled. - /// - /// - /// This can expose sensitive information, and should be turned on only to diagnose memory leaks. - /// As such, it is and must remain undocumented. - /// - [Argument(default, "dumpable")] - [EnvironmentVariable("DUMPABLE")] - [Description("enable run-time memory dumps via api")] - [RequiresRestart] - public bool Dumpable { get; init; } = false; - /// /// Gets a value indicating whether user-defined regular expressions are case sensitive. /// -- cgit v1.2.3