aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Relay
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-10-28 19:13:25 -0500
committerGitHub <noreply@github.com>2026-10-28 19:13:25 -0500
commit2e127575c5231ea94a2f327084c5da29b8a9e895 (patch)
treec155815345acac601326890d66d0ea8faf29fce3 /src/slskd/Relay
parent47c0c9fccbe976c1d1f8f71c6b0bfd45bceda1a4 (diff)
parent2b827344d11e7490b323defa898264cadbdb6089 (diff)
downloadslskd-2e127575c5231ea94a2f327084c5da29b8a9e895.tar.gz
Merge branch 'master' into bugs
Diffstat (limited to 'src/slskd/Relay')
-rw-r--r--src/slskd/Relay/API/Hubs/RelayHub.cs3
-rw-r--r--src/slskd/Relay/RelayClient.cs15
2 files changed, 15 insertions, 3 deletions
diff --git a/src/slskd/Relay/API/Hubs/RelayHub.cs b/src/slskd/Relay/API/Hubs/RelayHub.cs
index 8430164c..e839cd1a 100644
--- a/src/slskd/Relay/API/Hubs/RelayHub.cs
+++ b/src/slskd/Relay/API/Hubs/RelayHub.cs
@@ -85,7 +85,7 @@ namespace slskd.Relay
/// <summary>
/// The relay SignalR hub.
/// </summary>
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
public class RelayHub : Hub<IRelayHub>
{
/// <summary>
@@ -120,6 +120,7 @@ namespace slskd.Relay
{
Log.Debug("Agent connection {Id} from {IP} aborted; Relay is not enabled, or is not in Controller mode", Context.ConnectionId, GetRemoteIPAddress());
Context.Abort();
+ return;
}
var token = Relay.GenerateAuthenticationChallengeToken(Context.ConnectionId);
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 () =>