Skip to content

Commit c1e3f8b

Browse files
committed
Document security measures in README
1 parent 129239b commit c1e3f8b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,24 @@ MessagePack.Formatters.TypelessFormatter.BindToType = typeName =>
509509
};
510510
```
511511

512+
<a name="security"></a>Security
513+
---
514+
515+
Deserializing data from an untrusted source can introduce security vulnerabilities to your application.
516+
Depending on the settings used during deserialization, untrusted data may be able to execute arbitrary code or a denial of service attack.
517+
Untrusted data might come from over the Internet over an unauthenticated connection, from the local disk if it may have been tampered with, or many other sources.
518+
519+
When deserializing untrusted data, put MessagePack into a more secure mode with:
520+
521+
```cs
522+
MessagePackSecurity.Active = MessagePackSecurity.UntrustedData;
523+
```
524+
525+
In MessagePack v1.x this is a static property and thus the security level is shared by the entire process or AppDomain.
526+
Use MessagePack v2.1 or later for better control over the security level for your particular use.
527+
528+
You should also avoid the Typeless serializer/formatters/resolvers for untrusted data as that opens the door for the untrusted data to potentially deserialize unanticipated types that can compromise security.
529+
512530
Performance
513531
---
514532
Benchmarks comparing to other serializers run on `Windows 10 Pro x64 Intel Core i7-6700K 4.00GHz, 32GB RAM`. Benchmark code is [here](https://github.com/neuecc/ZeroFormatter/tree/master/sandbox/PerformanceComparison) - and there [version info](https://github.com/neuecc/ZeroFormatter/blob/bc63cb925d/sandbox/PerformanceComparison/packages.config), ZeroFormatter and [FlatBuffers](https://google.github.io/flatbuffers/) has infinitely fast deserializer so ignore deserialize performance.

0 commit comments

Comments
 (0)