Add file creation method that takes an ACL (dotnet/corefx#42099)
authorCarlos Sanchez Lopez <1175054+carlossanlop@users.noreply.github.com>
Tue, 29 Oct 2019 22:48:49 +0000 (15:48 -0700)
committerGitHub <noreply@github.com>
Tue, 29 Oct 2019 22:48:49 +0000 (15:48 -0700)
commit70e81317e7957c0769c64d56a9b1fcdb5d395e69
treeb28f76708f50f7d50b13155cddf574ae9f254e80
parent01aeaa57a1499b8bd9f218963dc53ed9b1ae40ca
Add file creation method that takes an ACL (dotnet/corefx#42099)

Approved API Proposal: dotnet/corefx#41614
Related change for directory creation method that takes an ACL: dotnet/corefx#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.

Commit migrated from https://github.com/dotnet/corefx/commit/508cbc4f1021e260b52981b8510cc5a5881441d3
12 files changed:
src/libraries/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln
src/libraries/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.cs
src/libraries/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx
src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj
src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.net46.cs
src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.netcoreapp.cs
src/libraries/System.IO.FileSystem.AccessControl/src/System/IO/FileSystemAclExtensions.netstandard.cs
src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs
src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Windows.cs
src/libraries/System.IO.FileSystem/tests/FileStream/CopyToAsync.cs
src/libraries/System.IO.FileSystem/tests/FileStream/Pipes.cs
src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj