-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add paragraph: Security Considerations
- Loading branch information
1 parent
c84baa2
commit 6eb15bd
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Security Considerations | ||
|
||
Image processing is a memory-intensive application. Most image processing libraries (including ImageSharp and SkiaSharp) decode images into in-memory buffers. Any publicly facing service using such a library might be vulnerable to DoS attacks without implementing further measures. | ||
|
||
For solutions using ImageSharp 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. | ||
// Any attempt to create a larger image will throw. | ||
AllocationLimitMegabytes = 256 | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters