diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-28 19:13:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-28 19:13:25 -0500 |
| commit | 2e127575c5231ea94a2f327084c5da29b8a9e895 (patch) | |
| tree | c155815345acac601326890d66d0ea8faf29fce3 /src/slskd/Relay/RelayClient.cs | |
| parent | 47c0c9fccbe976c1d1f8f71c6b0bfd45bceda1a4 (diff) | |
| parent | 2b827344d11e7490b323defa898264cadbdb6089 (diff) | |
| download | slskd-2e127575c5231ea94a2f327084c5da29b8a9e895.tar.gz | |
Merge branch 'master' into bugs
Diffstat (limited to 'src/slskd/Relay/RelayClient.cs')
| -rw-r--r-- | src/slskd/Relay/RelayClient.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index fef16573..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..."); @@ -366,6 +374,7 @@ namespace slskd.Relay catch (Exception ex) { Log.Error(ex, "Failed to handle authentication challenge: {Message}", ex.Message); + LoggedInTaskCompletionSource.TrySetException(ex); } } @@ -375,6 +384,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 +409,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 () => |
