Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Raven.Server/Web/Studio/DataDirectoryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,19 @@ public DataDirectoryInfo(
bool getNodesInfo, int requestTimeoutInMs, Stream responseBodyStream)
{
_serverStore = serverStore;
_path = path;
_path = SanitizePath(path);
_name = name;
_isBackup = isBackup;
_getNodesInfo = getNodesInfo;
_requestTimeoutInMs = requestTimeoutInMs;
_responseBodyStream = responseBodyStream;
}

private string SanitizePath(string path)
{
return Path.GetFileName(path);
}

public async Task UpdateDirectoryResult(string databaseName, string error)
{
var drivesInfo = PlatformDetails.RunningOnPosix ? DriveInfo.GetDrives() : null;
Expand Down
9 changes: 8 additions & 1 deletion src/Raven.Server/Web/Studio/StudioTasksHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Sparrow.Json;
using Sparrow.Json.Parsing;
using Voron.Util.Settings;

namespace Raven.Server.Web.Studio
{
public sealed class StudioTasksHandler : ServerRequestHandler
Expand All @@ -27,6 +26,14 @@ public sealed class StudioTasksHandler : ServerRequestHandler
public async Task FullDataDirectory()
{
var path = GetStringQueryString("path", required: false);
if (!string.IsNullOrEmpty(path))
{
path = Path.GetFullPath(path);
if (!path.StartsWith(ServerStore.Configuration.Core.DataDirectory.FullPath))
{
throw new InvalidOperationException("Invalid path");
}
}
var name = GetStringQueryString("name", required: false);
var requestTimeoutInMs = GetIntValueQueryString("requestTimeoutInMs", required: false) ?? 5 * 1000;

Expand Down