Improve path validation for Custom Script notifications

pull/1594/head
Qstick 3 years ago
parent f55fda9bac
commit cbdc2c51c4

@ -222,6 +222,16 @@ namespace NzbDrone.Core.Notifications.CustomScript
failures.Add(new NzbDroneValidationFailure("Path", "File does not exist"));
}
foreach (var systemFolder in SystemFolders.GetSystemFolders())
{
if (systemFolder.IsParentPath(Settings.Path))
{
failures.Add(new NzbDroneValidationFailure("Path", $"Must not be a descendant of '{systemFolder}'"));
}
}
if (failures.Empty())
{
try
{
var environmentVariables = new StringDictionary();
@ -239,6 +249,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
_logger.Error(ex);
failures.Add(new NzbDroneValidationFailure(string.Empty, ex.Message));
}
}
return new ValidationResult(failures);
}

Loading…
Cancel
Save