Browse Source

Fixes

pull/1308/head
Sebastian Stehle 4 months ago
parent
commit
e6dcdbd415
  1. 9
      backend/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs
  2. 6
      backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs
  3. 2
      backend/src/Squidex/Startup.cs

9
backend/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs

@ -6,6 +6,8 @@
// ========================================================================== // ==========================================================================
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Security;
using Microsoft.Extensions.Options;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Json; using Squidex.Infrastructure.Json;
@ -15,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Backup;
public sealed class TempFolderBackupArchiveLocation( public sealed class TempFolderBackupArchiveLocation(
IJsonSerializer serializer, IJsonSerializer serializer,
IOptions<BackupOptions> options, IOptions<BackupOptions> options,
IHttpClientFactory httpClientFactory) IHttpClientFactory httpClientFactory)
: IBackupArchiveLocation : IBackupArchiveLocation
{ {
public async Task<IBackupReader> OpenReaderAsync(Uri url, DomainId id, public async Task<IBackupReader> OpenReaderAsync(Uri url, DomainId id,
@ -25,6 +27,11 @@ public sealed class TempFolderBackupArchiveLocation(
if (string.Equals(url.Scheme, "file", StringComparison.OrdinalIgnoreCase)) if (string.Equals(url.Scheme, "file", StringComparison.OrdinalIgnoreCase))
{ {
if (!options.Value.AllowRestoreFromLocalFiles)
{
throw new SecurityException("Downloading backups from local files not allowed. Permit them with BACKUPS__ALLOWRESTOREFROMLOCALFILES=true");
}
stream = new FileStream(url.LocalPath, FileMode.Open, FileAccess.Read); stream = new FileStream(url.LocalPath, FileMode.Open, FileAccess.Read);
} }
else else

6
backend/src/Squidex.Infrastructure/EventSourcing/Consume/EventConsumerProcessor.cs

@ -73,8 +73,10 @@ public class EventConsumerProcessor : IEventSubscriber<ParsedEvents>
} }
} }
// Acquire the lock to ensure any in-flight UpdateAsync has fully completed before returning. using (await asyncLock.EnterAsync())
using var _ = await asyncLock.EnterAsync(); {
// Acquire the lock to ensure any in-flight UpdateAsync has fully completed before returning.
}
} }
public virtual ValueTask OnNextAsync(IEventSubscription subscription, ParsedEvents @event) public virtual ValueTask OnNextAsync(IEventSubscription subscription, ParsedEvents @event)

2
backend/src/Squidex/Startup.cs

@ -37,7 +37,7 @@ public sealed class Startup(IConfiguration config)
services.AddSquidexApps(config); services.AddSquidexApps(config);
services.AddSquidexAssetInfrastructure(config); services.AddSquidexAssetInfrastructure(config);
services.AddSquidexAssets(config); services.AddSquidexAssets(config);
services.AddSquidexBackups(); services.AddSquidexBackups(config);
services.AddSquidexCollaborations(config); services.AddSquidexCollaborations(config);
services.AddSquidexCommands(config); services.AddSquidexCommands(config);
services.AddSquidexContents(config); services.AddSquidexContents(config);

Loading…
Cancel
Save