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
* First commit
* Fix OperationCanceledException dependency error, revert nullable indication
* Only Directory files
* Unit tests verifications
* Split FileSystem.Windows into two additional files instead of one. Fix pinning.
* Remove dead comment, add actual UT verifications
* User WellKnownSidType
* Make method unsafe, nit comments addressed.
* Remove irrelevant comment
* Add additional exceptions to triple slash
* Add unit tests for additional exceptions
* Remove FileSystem.cs, it has one obsolete method. Replace all calls of that removed method.
* Second pass on required strings.resx resources
* Remove unused dependency cs files
* Move shared files to Common
* Add the missing braces
* Add nulcheck for this argument, add exception, document exception in triple slash, add unit test.
* Fix netstandard CI build failure
* Fix Microsoft.IO.Redist build issue with NetStandard
* Remove unnecessary assert in ut
* Fix build problem in Windows Packaging All Configurations x64_Debug, System.Runtime needs to be included to recognize NotNullIfNotNullAttribute, consumed in Path.Internal.cs
* Additional file splitting and dependency addition to fix netstandard/netfx build problems
* Fix netstandard and netcoreapp build issues
* Remove unused file
* nit cleaning
* Minimal unit tests
* Remove unused unit test code and spacing fix
* Add full framework condition to unit test
* Additional fix for full framework
Commit migrated from https://github.com/dotnet/corefx/commit/5ed2e98718700ba37ed95c34ee04960b5aba1aa0
* -Added new classes to handle the unit tests for the following libraries:
FileSysyemAuditRule.CS
DirectoryObjectSecurity.CS
-Added new unit tests to the 'FileSystemAclExtensionsTests.cs' class
* updated the files according to the suggested code standards for test cases.
* updated the file according to the suggested code standards.
* Updated some of the test cases and ran the CodeFormatter tool.
* Removed the invalid terms in the code.
Commit migrated from https://github.com/dotnet/corefx/commit/12d25b0445f67ac299de5abb2af7af767c135c88
* Improve code coverage for System.IO.FileSystem.AccessControl
* Added check on parameter names for ArgumentNullExceptions and only passing in one null parameter
* add tests for gets and sets that do not throw exceptions
* renamed tests with returns valid object and removed set tests
* use temp directory and file
* use temp directory and file
* use TempDirectory and TempFile from Common code
* remove reference that is not needed
* call extension method from object
Commit migrated from https://github.com/dotnet/corefx/commit/ca5e2ecb33359a4c55ed7407ecc0b49bc78e3760
Adding these gives us a place to put tests for the associated libraries, and also ensures that the libraries show up in code coverage. Each library is empty with the exception of a single test that's necessary for code coverage to pick it up. includes skeleton projects for:
- Microsoft.CSharp
- Microsoft.VisualBasic
- Microsoft.Win32.Registry.AccessControl
- System.Data.Common
- System.IO.FileSystem.AccessControl
- System.Reflection.Context
- System.Security.Claims
- System.Threading.AccessControl
Commit migrated from https://github.com/dotnet/corefx/commit/3b1efe2956682a5a240f9354787e05aab1b3edfc