Skip to content

Conversation

@dellis1972
Copy link
Contributor

Fixes #64

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.

This commit implements this in the Native.cs file. We are using
an assembly level atribute but place it in the area where all the
native calls are maintained.

Looks like VSCode decided to clean up some whitespace :/

Fixes dotnet#64

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`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.defaultdllimportsearchpathsattribute?view=netcore-3.1)
attribute should be placed either on the assembly or on `[DllImport]`
methods, to control and constrain where [`LoadLibraryEx()`](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa?redirectedfrom=MSDN)
will look for native libraries.

This commit implements this in the `Native.cs` file. We are using
an assembly level atribute but place it in the area where all the
native calls are maintained.
@dellis1972 dellis1972 requested a review from grendello August 5, 2020 13:53
@grendello grendello merged commit 96eb5e3 into dotnet:master Aug 5, 2020
@dellis1972 dellis1972 deleted the Issue64 branch August 5, 2020 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use DefaultDllImportSearchPathsAttribute

2 participants