diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-07-21 07:14:47 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-07-21 07:14:47 +0200 |
| commit | b99703301f43927f632bbc49d040a32824d43cb3 (patch) | |
| tree | d57fed2bd6b658ddf6b1ac3ed4d2a33945f8688a /Jellyfin.Api/Controllers/PluginsController.cs | |
| parent | 21801e8ba138af71c4c58489ea33534adf7426c5 (diff) | |
| parent | bdf263d8677ee87078c680a355a91a8048b8308b (diff) | |
Merge remote-tracking branch 'upstream/master' into security-path-traversal-fixes
# Conflicts:
# Jellyfin.Api/Controllers/HlsSegmentController.cs
# Jellyfin.Api/Controllers/PluginsController.cs
Diffstat (limited to 'Jellyfin.Api/Controllers/PluginsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/PluginsController.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.cs index 3bb8bb7077..79b8b60cb7 100644 --- a/Jellyfin.Api/Controllers/PluginsController.cs +++ b/Jellyfin.Api/Controllers/PluginsController.cs @@ -227,10 +227,13 @@ public class PluginsController : BaseJellyfinApiController return NotFound(); } - if (!string.IsNullOrEmpty(plugin.Manifest.ImagePath)) + string? imagePath = plugin.Manifest.ImagePath; + if (!string.IsNullOrWhiteSpace(imagePath)) { - var imagePath = Path.GetFullPath(Path.Combine(plugin.Path, plugin.Manifest.ImagePath)); - if (!PathHelper.IsContainedIn(plugin.Path, imagePath) || !System.IO.File.Exists(imagePath)) + var pluginPath = Path.TrimEndingDirectorySeparator(Path.GetFullPath(plugin.Path)); + imagePath = Path.GetFullPath(imagePath, pluginPath); + // Require a separator after the plugin path so a sibling like "<pluginPath>-evil" can't pass. + if (imagePath.StartsWith(pluginPath + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) is false || System.IO.File.Exists(imagePath) is false) { return NotFound(); } |
