Commit Graph
10 Commits
Author SHA1 Message Date
Carlos Sanchez Lopez 70e81317e7 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
2019-10-29 15:48:49 -07:00
Carlos Sanchez Lopez bdb751bf52 Add directory creation method that takes an ACL (dotnet/corefx#41834)
* 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
2019-10-22 19:42:48 -07:00
Stephen Toub e5ff70defe Fix some license headers across the repo (dotnet/corefx#27039)
Commit migrated from https://github.com/dotnet/corefx/commit/7f19e761b7400521030707df2e6fac10daa36f26
2018-02-11 08:55:26 -05:00
Hugh Bellamy 7c660f36bb Update remaining argument*exceptions to have param names (dotnet/corefx#21650)
Commit migrated from https://github.com/dotnet/corefx/commit/ea1bc38c237dfb768e7d442efa95cab785e89ac3
2017-06-28 06:44:57 -07:00
8to5Developer bc3a5de554 Improve code coverage of System.IO.FileSystem.AccessControl (35.7%) (dotnet/corefx#20680)
* -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
2017-06-12 18:23:15 -07:00
Viktor Hofer 69408edf6d Deactivating System.IO.FileSystem.AccessControl tests on uap/uapaot (dotnet/corefx#19750)
* Deactivating ACL tests on uap/uapaot

* Add reason why disabling tests

* Disabling tests for uap/uapaot

* Changed project configs in test


Commit migrated from https://github.com/dotnet/corefx/commit/6fc97cfbc24d97a2d4843cfc10db28d8bfc2141d
2017-05-16 01:31:39 -07:00
Daniel Harvey 252cdc5e95 Bulk updates of tests for AssertExtensions (dotnet/corefx#18491)
Bulk update to AssertExtensions.Throws for AOT support. This doesn't disable Assert.Throws.

Commit migrated from https://github.com/dotnet/corefx/commit/b43b4df2e0e2182154bb0f425cb4a61bc1269828
2017-04-18 09:52:02 -07:00
the-dwyer dd8e887b5d Improve code coverage for System.IO.FileSystem.AccessControl from 2.3% to 8.7% (dotnet/corefx#15815)
* 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
2017-02-23 11:38:13 -08:00
the-dwyer 1561c15c2a Improve code coverage for System.IO.FileSystem.AccessControl (dotnet/corefx#15375)
* Improve code coverage for System.IO.FileSystem.AccessControl

* Added check on parameter names for ArgumentNullExceptions and only passing in one null parameter

Commit migrated from https://github.com/dotnet/corefx/commit/b036d7a59620ad3812ca966f634e827a745f4475
2017-01-23 10:13:00 -08:00
stephentoub f2c4306f31 Add several missing test projects
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
2016-01-31 21:55:10 -05:00