Serialization updates
Thanks to @cole-brown for doing the leg work on updating filecache. Notes from his PR:
BinaryFormatter is a security issue in .NET 5.0 - this replaces it in most places.
https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide
BinaryFormatter is replaced with BinaryReader/BinaryWriter for:
sysfiles
policies
ReadFile w/ PayloadMode.RawBytes
WriteFile w/ PayloadMode.RawBytes
Cache files that use BinaryReader/BinaryWriter have a "magic" header number that is checked for in order to make the transition from 3.2.0 to this patch without needing to delete your file cache. The old files will just fail the new header check and the sysfile/policy/etc will continue on as if it were a failed read/missing file.
BinaryFormatter remains for:
ReadFile w/ PayloadMode.Serialize
WriteFile w/ PayloadMode.Serialize
Those would need to be serialized some other way that wasn't needed for our use case.
You could look into adding ZeroFormatter as a dependency:
https://neuecc.medium.com/zeroformatter-fastest-c-serializer-and-infinitely-fast-deserializer-for-net-88e752803fe9
https://github.com/neuecc/ZeroFormatter/
https://www.nuget.org/packages/ZeroFormatter
Or possibly using an XML/JSON formatter instead:
https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide#preferred-alternatives
This pull request partially addresses: #49