From e6458e011c745eb0b0f6b0ce0474491381438178 Mon Sep 17 00:00:00 2001 From: Charles Bellemare Date: Mon, 19 Oct 2026 23:26:35 -0400 Subject: Fix missing space in version update message --- src/web/src/components/App.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/src/components/App.jsx b/src/web/src/components/App.jsx index 3fbaa468..1de25eec 100644 --- a/src/web/src/components/App.jsx +++ b/src/web/src/components/App.jsx @@ -499,7 +499,7 @@ class App extends Component {

You are currently running version{' '} - {current} + {current}{' '} while version {latest} is available.

-- cgit v1.2.3 From edc2f0df06235178837d11b4a2916a144b5b7c30 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:52:41 -0500 Subject: add 'dumpable' option --- src/slskd/Core/Options.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 05eaed57..d2aba37f 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -483,6 +483,19 @@ 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 From c9b85e9f1280a4efa70c0401fdf3677eadefec4e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:52:57 -0500 Subject: log warning at startup if dumpable is enabled --- src/slskd/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index e236886b..cdfbbf33 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -509,6 +509,11 @@ namespace slskd Log.Information("Using application directory {AppDirectory}", AppDirectory); Log.Information("Using configuration file {ConfigurationFile}", ConfigurationFile); + if (OptionsAtStartup.Flags.Dumpable) + { + Log.Warning("Application memory dumps are ENABLED; this can expose sensitive information, including environment variables from the shell. Disable Flags.Dumpable to disable."); + } + if (OptionsAtStartup.Flags.NoConfigWatch) { Log.Warning("Configuration watch DISABLED; all configuration changes will require a restart to take effect"); -- cgit v1.2.3 From 46c4714a1377d698f6b35879a276d8be8f11dfe7 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:54:18 -0500 Subject: require administrator role for dumps, check Dumpable option first --- .../Core/API/Controllers/ApplicationController.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index 70c260f6..b0051dbd 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -42,6 +42,7 @@ namespace slskd.Core.API using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Hosting; using Serilog; + using slskd.Authentication; /// /// Application. @@ -57,17 +58,20 @@ namespace slskd.Core.API IHostApplicationLifetime lifetime, IApplication application, IOptionsMonitor optionsMonitor, + OptionsAtStartup optionsAtStartup, IStateMonitor applicationStateMonitor) { Lifetime = lifetime; Application = application; OptionsMonitor = optionsMonitor; + OptionsAtStartup = optionsAtStartup; ApplicationStateMonitor = applicationStateMonitor; } private IApplication Application { get; } private IStateMonitor ApplicationStateMonitor { get; } private IOptionsMonitor OptionsMonitor { get; } + private OptionsAtStartup OptionsAtStartup { get; } private IHostApplicationLifetime Lifetime { get; } private ILogger Log { get; } = Serilog.Log.ForContext(); @@ -160,13 +164,23 @@ namespace slskd.Core.API [ApiExplorerSettings(IgnoreApi = true)] [HttpGet("dump")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public async Task DumpMemory() { - using var dumper = new Dumper(); - var file = await dumper.DumpAsync(); + 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"); + } - 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)] -- cgit v1.2.3 From f7da9a79fd5de7e4dd675f279317cbea49cea851 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:54:46 -0500 Subject: require r/w role for loopback --- src/slskd/Core/API/Controllers/ApplicationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index b0051dbd..a9630e5c 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -185,7 +185,7 @@ namespace slskd.Core.API [ApiExplorerSettings(IgnoreApi = true)] [HttpPost("loopback")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] public IActionResult Loopback([FromBody] object body) { Log.Information("Loopback POST: {Body}", body); -- cgit v1.2.3 From e20ccd6abd0e86006b7a66d10dd35d0212281cfb Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:55:05 -0500 Subject: require admin for garbage collection --- src/slskd/Core/API/Controllers/ApplicationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index a9630e5c..84ddf063 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -154,7 +154,7 @@ namespace slskd.Core.API /// [ApiExplorerSettings(IgnoreApi = true)] [HttpPost("gc")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public IActionResult CollectGarbage() { Application.CollectGarbage(); -- cgit v1.2.3 From c6983ea67c974bf39b9df9aa0eeab292d3969012 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:57:12 -0500 Subject: restrict forced version check to r/w --- src/slskd/Core/API/Controllers/ApplicationController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index 84ddf063..c9af1296 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -137,11 +137,16 @@ namespace slskd.Core.API /// /// [HttpGet("version/latest")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.Any)] public async Task CheckVersion([FromQuery] bool forceCheck = false) { if (forceCheck) { + if (!User.IsInRole(nameof(Role.ReadWrite)) && !User.IsInRole(nameof(Role.Administrator))) + { + return Forbid(); + } + await Application.CheckVersionAsync(); } -- cgit v1.2.3 From e351adcf4c298dd4bab32406a4d2b4a6eae6e63e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:57:39 -0500 Subject: remove guest,admin (why??), order from least-> most --- src/slskd/Common/Authentication/AuthRole.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/slskd/Common/Authentication/AuthRole.cs b/src/slskd/Common/Authentication/AuthRole.cs index 958cc143..f44b76cb 100644 --- a/src/slskd/Common/Authentication/AuthRole.cs +++ b/src/slskd/Common/Authentication/AuthRole.cs @@ -42,7 +42,6 @@ namespace slskd { public const string AdministratorOnly = "Administrator"; public const string ReadWriteOrAdministrator = "ReadWrite,Administrator"; - public const string GuestOrAdministrator = "Guest,Administrator"; - public const string Any = "ReadOnly,ReadWrite,Guest,Administrator"; + public const string Any = "Guest,ReadOnly,ReadWrite,Administrator"; } } -- cgit v1.2.3 From d591b9598d44d7ba25217f818c19090da17b0df1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:58:59 -0500 Subject: require admin for entire options controller --- src/slskd/Core/API/Controllers/OptionsController.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/slskd/Core/API/Controllers/OptionsController.cs b/src/slskd/Core/API/Controllers/OptionsController.cs index 2d314b5f..e20017a8 100644 --- a/src/slskd/Core/API/Controllers/OptionsController.cs +++ b/src/slskd/Core/API/Controllers/OptionsController.cs @@ -53,6 +53,7 @@ namespace slskd.Core.API [ApiController] [Produces("application/json")] [Consumes("application/json")] + [Authorize(Roles = AuthRole.AdministratorOnly)] public class OptionsController : ControllerBase { public OptionsController( @@ -75,7 +76,7 @@ namespace slskd.Core.API /// /// [HttpGet] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] [ProducesResponseType(typeof(Options), 200)] public IActionResult Current() { @@ -127,7 +128,7 @@ namespace slskd.Core.API /// [HttpGet] [Route("startup")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] [ProducesResponseType(typeof(Options), 200)] public IActionResult Startup() { @@ -221,7 +222,7 @@ namespace slskd.Core.API } [HttpPost] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] [Route("yaml/validate")] public IActionResult ValidateYamlFile([FromBody] string yaml) { -- cgit v1.2.3 From 49968f92871c6bab0368136f373a76c07edbd6f0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 21:59:35 -0500 Subject: require r/w for server connect/disconnect --- src/slskd/Core/API/Controllers/ServerController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/slskd/Core/API/Controllers/ServerController.cs b/src/slskd/Core/API/Controllers/ServerController.cs index dd9c37d2..70adb858 100644 --- a/src/slskd/Core/API/Controllers/ServerController.cs +++ b/src/slskd/Core/API/Controllers/ServerController.cs @@ -48,6 +48,7 @@ namespace slskd.Core.API [ApiController] [Produces("application/json")] [Consumes("application/json")] + [Authorize(Roles = AuthRole.AdministratorOnly)] public class ServerController : ControllerBase { public ServerController( @@ -73,7 +74,7 @@ namespace slskd.Core.API /// [HttpPut] [Route("")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(200)] [ProducesResponseType(StatusCodes.Status205ResetContent)] [ProducesResponseType(403)] @@ -109,7 +110,7 @@ namespace slskd.Core.API /// [HttpDelete] [Route("")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(204)] [ProducesResponseType(403)] public IActionResult Disconnect([FromBody] string message) -- cgit v1.2.3 From c5ec01c457d47759c5cd2926af9c381b4a26d30f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 22:06:16 -0500 Subject: remove Guest entirely --- src/slskd/Common/Authentication/AuthRole.cs | 2 +- src/slskd/Common/Authentication/Role.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/slskd/Common/Authentication/AuthRole.cs b/src/slskd/Common/Authentication/AuthRole.cs index f44b76cb..a497dec4 100644 --- a/src/slskd/Common/Authentication/AuthRole.cs +++ b/src/slskd/Common/Authentication/AuthRole.cs @@ -42,6 +42,6 @@ namespace slskd { public const string AdministratorOnly = "Administrator"; public const string ReadWriteOrAdministrator = "ReadWrite,Administrator"; - public const string Any = "Guest,ReadOnly,ReadWrite,Administrator"; + public const string Any = "ReadOnly,ReadWrite,Administrator"; } } diff --git a/src/slskd/Common/Authentication/Role.cs b/src/slskd/Common/Authentication/Role.cs index d081c198..42314c2d 100644 --- a/src/slskd/Common/Authentication/Role.cs +++ b/src/slskd/Common/Authentication/Role.cs @@ -36,7 +36,6 @@ namespace slskd.Authentication { ReadOnly = 0, ReadWrite = 1, - Guest = 2, Administrator = 3, } } -- cgit v1.2.3 From 2ec8380bc37da6c784456d61850b65c8e45af751 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 22:09:07 -0500 Subject: require admin for debug and logs --- src/slskd/Core/API/Controllers/DebugController.cs | 3 ++- src/slskd/Core/API/Controllers/LogsController.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slskd/Core/API/Controllers/DebugController.cs b/src/slskd/Core/API/Controllers/DebugController.cs index b5f6cd33..7f4dcafc 100644 --- a/src/slskd/Core/API/Controllers/DebugController.cs +++ b/src/slskd/Core/API/Controllers/DebugController.cs @@ -46,6 +46,7 @@ namespace slskd.Core.API [ApiController] [Produces("application/json")] [Consumes("application/json")] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public class DebugController : ControllerBase { public DebugController(ISoulseekClient soulseekClient) @@ -56,7 +57,7 @@ namespace slskd.Core.API private ISoulseekClient Client { get; } [HttpGet("transfers")] - [Authorize(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] [ProducesResponseType(typeof(Transfer), 200)] public IActionResult Transfers() { diff --git a/src/slskd/Core/API/Controllers/LogsController.cs b/src/slskd/Core/API/Controllers/LogsController.cs index a83e608c..c11d8ff3 100644 --- a/src/slskd/Core/API/Controllers/LogsController.cs +++ b/src/slskd/Core/API/Controllers/LogsController.cs @@ -51,6 +51,7 @@ namespace slskd.Core.API [ApiController] [Produces("application/json")] [Consumes("application/json")] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.AdministratorOnly)] public class LogsController : ControllerBase { public LogsController(FileService fileService) -- cgit v1.2.3 From a885e116b1eae3f38ba4da97bb6bc1a3f856eea3 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 22 Oct 2026 22:35:11 -0500 Subject: name role names type safe --- src/slskd/Common/Authentication/AuthRole.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slskd/Common/Authentication/AuthRole.cs b/src/slskd/Common/Authentication/AuthRole.cs index a497dec4..e9cd38aa 100644 --- a/src/slskd/Common/Authentication/AuthRole.cs +++ b/src/slskd/Common/Authentication/AuthRole.cs @@ -32,6 +32,8 @@ namespace slskd { + using slskd.Authentication; + /// /// Authentication roles. /// @@ -40,8 +42,8 @@ namespace slskd /// public static class AuthRole { - public const string AdministratorOnly = "Administrator"; - public const string ReadWriteOrAdministrator = "ReadWrite,Administrator"; - public const string Any = "ReadOnly,ReadWrite,Administrator"; + public const string AdministratorOnly = $"{nameof(Role.Administrator)}"; + public const string ReadWriteOrAdministrator = $"{nameof(Role.ReadWrite)},{nameof(Role.Administrator)}"; + public const string Any = $"{nameof(Role.ReadOnly)},{nameof(Role.ReadWrite)},{nameof(Role.Administrator)}"; } } -- cgit v1.2.3