diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-31 19:52:59 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-10-31 19:52:59 -0500 |
| commit | cbd03ff1adc5d703a2023ae9532b3001542c0c2d (patch) | |
| tree | f86be6c9790273ca64ba59376de3b2b26c4879b0 /src/slskd/Relay/RelayClient.cs | |
| parent | 926446c443afca46b853a0b8f5fa85297b56ede2 (diff) | |
| parent | 2e127575c5231ea94a2f327084c5da29b8a9e895 (diff) | |
| download | slskd-cbd03ff1adc5d703a2023ae9532b3001542c0c2d.tar.gz | |
Merge branch 'bugs' of github.com:slskd/slskd 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 () => |
