Merge pull request #67 from SixLabors/af/security

Security Considerations
This commit is contained in:
James Jackson-South 2024-04-15 20:29:50 +10:00 коммит произвёл GitHub
Родитель 396bdc3388 03ece61260
Коммит db74567a08
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,19 @@
# Security Considerations
Image processing is a memory-intensive application. Most image processing libraries (including ImageSharp, SkiaSharp, and Magick.NET) decode images into in-memory buffers for further processing. Without additional measures, any publicly facing service that consumes images coming from untrusted sources might be vulnerable to DoS attacks attempting to deplete process memory.
Such measures can be:
- Authentication, for example by using HMAC. See [Securing Processing Commands in ImageSharp.Web](../imagesharp.web/processingcommands.md#securing-processing-commands).
- Offloading to separate services/containers.
- Placing the solution behind a reverse proxy.
- Rate Limiting.
- Imposing conservative allocation limits by configuring a custom `MemoryAllocator`:
```csharp
Configuration.Default.MemoryAllocator = MemoryAllocator.Create(new MemoryAllocatorOptions()
{
// Note that this limits the maximum image size to 64 megapixels of Rgba32.
// Any attempt to create a larger image will throw.
AllocationLimitMegabytes = 256
});
```

Просмотреть файл

@ -8,6 +8,7 @@
### [Working with Pixel Buffers](imagesharp/pixelbuffers.md)
### [Configuration](imagesharp/configuration.md)
### [Memory Management](imagesharp/memorymanagement.md)
### [Security Considerations](imagesharp/security.md)
# [ImageSharp.Drawing](imagesharp.drawing/index.md)
## [Getting Started](imagesharp.drawing/gettingstarted.md)