From 8b68a8ea7733ad1a4a9e85f296d9f628b71d3e64 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 24 Oct 2026 20:59:38 -0500 Subject: mark props that might contain secrets as secret --- src/slskd/Core/Options.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/slskd/Core/Options.cs') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index d2aba37f..9119a8fe 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1466,6 +1466,7 @@ namespace slskd [EnvironmentVariable("LOKI")] [Description("optional; url to a Grafana Loki instance to which to log")] [RequiresRestart] + [Secret] public string Loki { get; init; } = null; /// @@ -2585,6 +2586,7 @@ namespace slskd /// Gets the fully qualified URL for the webhook. /// [NotNullOrWhiteSpace] + [Secret] public string Url { get; init; } /// @@ -2621,6 +2623,7 @@ namespace slskd /// /// Gets the header's value. /// + [Secret] public string Value { get; init; } } @@ -2661,6 +2664,7 @@ namespace slskd /// /// Gets the shell command to run. /// + [Secret] public string Command { get; init; } /// @@ -2674,6 +2678,7 @@ namespace slskd /// /// Mutually exclusive with . /// + [Secret] public string Args { get; init; } /// -- cgit v1.2.3 From 1cc109a40d1b1d2a8c023c70b44621916641f991 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 11:09:52 -0500 Subject: fix mistake with minimum value --- src/slskd/Core/Options.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/slskd/Core/Options.cs') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 9119a8fe..3a111a99 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -2256,7 +2256,7 @@ namespace slskd [Argument(default, "jwt-ttl")] [EnvironmentVariable("JWT_TTL")] [Description("TTL for JWTs")] - [Range(3600, int.MaxValue)] + [Range(3600000, int.MaxValue)] [RequiresRestart] public int Ttl { get; init; } = 604800000; } -- cgit v1.2.3 From 4ce05449570276bf00ba3be4f7e747d268fa9ebf Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 25 Oct 2026 15:12:55 -0500 Subject: use existing enum validation for envar api keys --- src/slskd/Core/Options.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/slskd/Core/Options.cs') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 3a111a99..dd9c3d02 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -2199,9 +2199,12 @@ namespace slskd { var role = tuple.Split('=').LastOrDefault(); - if (!Enum.TryParse(typeof(Role), value: role, ignoreCase: true, out _)) + var roleResult = new EnumAttribute(typeof(Role), ignoreCase: true) + .GetValidationResult(role, new ValidationContext(this) { MemberName = nameof(ApiKey), DisplayName = "API key role" }); + + if (roleResult != ValidationResult.Success) { - results.Add(new ValidationResult($"API key role must be one of: {string.Join(", ", Enum.GetNames(typeof(Role)))}")); + results.Add(new ValidationResult(roleResult.ErrorMessage)); } } else if (tuple.StartsWith("cidr=", StringComparison.OrdinalIgnoreCase)) -- cgit v1.2.3