diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-05-11 19:04:44 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-05-11 19:04:44 -0500 |
| commit | 4b0b663a5bc1dc64d52485eb7be1bce5df73478c (patch) | |
| tree | ed17cfa16fe7c4c0ca5e44b1a0979edcdccacf9b /src/slskd/Relay/API/Controllers/RelayController.cs | |
| parent | 7cd70a730b6cd57952f2e233378cd6bb244f56b1 (diff) | |
| download | slskd-4b0b663a5bc1dc64d52485eb7be1bce5df73478c.tar.gz | |
wip
Diffstat (limited to 'src/slskd/Relay/API/Controllers/RelayController.cs')
| -rw-r--r-- | src/slskd/Relay/API/Controllers/RelayController.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index 0d2ef9c5..f0ab0457 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -159,7 +159,12 @@ namespace slskd.Relay return Unauthorized(); } - var sourceFile = Path.Combine(OptionsMonitor.CurrentValue.Directories.Downloads, filename); + // if we get this far, the caller has supplied a valid credential and filename, meaning the request + // to download is being made in response to the controller signaling the agent that a download had completed. + // it's not possible for the client to download arbitrary files; credentials are computed from a token, and + // this token is cached in the controller, so only file downloads that the controller solicited are possible + // still, for the abundance of caution, use the CombineSafely method in case the filename has traversal segments + var sourceFile = FileSafety.CombineSafely(OptionsMonitor.CurrentValue.Directories.Downloads, filename); Log.Information("Agent {Agent} authenticated for token {Token}. Sending file {Filename}", agentName, guid, filename); |
