feat: enforce resolved catalog path roles
This commit is contained in:
@@ -7,14 +7,14 @@ namespace Launcher.Next.Infrastructure;
|
||||
/// local immutable staging by <see cref="IPackageSynchronizer"/>; it is never
|
||||
/// an active launch root.
|
||||
/// </summary>
|
||||
public sealed class FileSystemCatalogPackageAcquirer(string catalogRoot) : IPackageCatalogPackageAcquirer
|
||||
public sealed class FileSystemCatalogPackageAcquirer(ResolvedCatalogRoot catalogRoot) : IPackageCatalogPackageAcquirer
|
||||
{
|
||||
private const int MaxFiles = 256;
|
||||
private const long MaxBytes = 512L * 1024 * 1024;
|
||||
|
||||
public async Task<CatalogPackage?> AcquireAsync(PackageRequirement requirement, CancellationToken cancellationToken)
|
||||
{
|
||||
var root = Path.GetFullPath(catalogRoot);
|
||||
var root = catalogRoot.Value;
|
||||
var candidate = Path.GetFullPath(Path.Combine(root, requirement.PackageId, requirement.RequiredVersion));
|
||||
if (!Directory.Exists(root) || IsReparsePoint(root) || !IsWithin(root, candidate) || !Directory.Exists(candidate) || IsReparsePoint(candidate))
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user