Add file creation method that takes an ACL (dotnet/corefxdotnet/coreclr#42099)
authorCarlos Sanchez Lopez <1175054+carlossanlop@users.noreply.github.com>
Tue, 29 Oct 2019 22:48:49 +0000 (15:48 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 30 Oct 2019 03:55:59 +0000 (20:55 -0700)
commit46ed1601a853aa3a4e8fdedb81ce9f3439b33003
tree12167407f72927aba98027a51f99217bfac35fa7
parentece6e61e184eed8cddb07b750f724b751a78ba08
Add file creation method that takes an ACL (dotnet/corefxdotnet/coreclr#42099)

Approved API Proposal: dotnet/coreclr#41614
Related change for directory creation method that takes an ACL: dotnet/coreclr#41834 -merged and ported to 3.1 Prev2

Description
We have extension methods in System.IO.FileSystem.AclExtensions that let the user get and set ACLs for existing files, but we do not have methods that create files with predefined ACLs.
.NET ACL (Access Control List) support is Windows specific. This change will reside inside the System.IO.FileSystem.AccessControl assembly.

Customer impact
Before this change, customers had to create a file or filestream, then set its ACLs. This presents a few problems:

Potential security hole as files can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
Stability issues with background processes (file filters) can prevent modifying ACLs right after creation (typically surfaces as a security exception).
This change addresses those problems by adding a new extension method that allows creating a file and ensuring the provided ACLs are set during creation.
This change is expected to be backported to 3.1.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/be9323fa75dba520599815b1faa68e19a87a39a9
src/libraries/System.Private.CoreLib/src/System/IO/Win32Marshal.cs