From 33110721157f48183ebac1161896ca0a4f7af196 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 23 Oct 2026 15:17:45 -0500 Subject: halt processing if given a path with traversal --- src/slskd/Relay/RelayClient.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/slskd/Relay/RelayClient.cs') diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index fef16573..9a587d5e 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -375,6 +375,7 @@ namespace slskd.Relay { Log.Warning("Suspicious attempt to request file info containing unsafe path segments (one or more of path traversal characters '.' and '..'). Requested file: {filename}", filename); await HubConnection.InvokeAsync(nameof(RelayHub.ReturnFileInfo), id, false, 0); + return; } Log.Information("Relay controller requested file info for {Filename} with ID {Id}", filename, id); @@ -399,7 +400,8 @@ namespace slskd.Relay if (FileSafety.ContainsTraversalSegments(filename)) { Log.Warning("Suspicious attempt to request a file upload containing unsafe path segments (one or more of path traversal characters '.' and '..'). Requested file: {filename}", filename); - await HubConnection.InvokeAsync(nameof(RelayHub.NotifyFileUploadFailed), token); + await HubConnection.InvokeAsync(nameof(RelayHub.NotifyFileUploadFailed), token, "Requested filename contains unsafe path segments"); + return; } _ = Task.Run(async () => -- cgit v1.2.3 From df289696a24efd01a070e0b92b08f2d9f293c2b3 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 23 Oct 2026 15:19:13 -0500 Subject: throw logged in tcs on exception --- src/slskd/Relay/RelayClient.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/slskd/Relay/RelayClient.cs') diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index 9a587d5e..ebb4eb52 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -366,6 +366,7 @@ namespace slskd.Relay catch (Exception ex) { Log.Error(ex, "Failed to handle authentication challenge: {Message}", ex.Message); + LoggedInTaskCompletionSource.TrySetException(ex); } } -- cgit v1.2.3 From 3f117404a2e12158803e90637cf0f83ae570837f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 23 Oct 2026 15:21:26 -0500 Subject: stop following a login failure --- src/slskd/Relay/RelayClient.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/slskd/Relay/RelayClient.cs') diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index ebb4eb52..cbcde3c4 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -148,7 +148,15 @@ namespace slskd.Relay // the controller will send an authentication challenge immediately after connection // wait for the auth handler to log in before proceeding with the initial share upload - await LoggedInTaskCompletionSource.Task; + try + { + await LoggedInTaskCompletionSource.Task; + } + catch (Exception) + { + await StopAsync(cancellationToken); + throw; + } Log.Information("Uploading shares..."); -- cgit v1.2.3