dotnet / android-libzipsharp

A managed wrapper (and then some) around libzip (https://libzip.org/)
MIT License
30 stars 12 forks source link

Use DefaultDllImportSearchPathsAttribute #64

Closed jonpryor closed 4 years ago

jonpryor commented 4 years ago

Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1139578 Context: https://liquid.microsoft.com/Web/Object/Read/ms.security/Requirements/Microsoft.Security.SystemsADM.10039#guide

The current security guidance is that the System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute attribute should be placed either on the assembly or on [DllImport] methods, to control and constrain where LoadLibraryEx() will look for native libraries.

The advice is to use:

[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)]