[release/3.0]Handle UnparseableExtension status code when building X509Chain on …#40117
[release/3.0]Handle UnparseableExtension status code when building X509Chain on …#40117buyaa-n merged 5 commits intodotnet:release/3.0from
UnparseableExtension status code when building X509Chain on …#40117Conversation
…OSX (dotnet#40063) Setting related error flag for newly introduced error status
Sure will wait |
|
@danmosemsft I'm good with that |
|
K I’ll take to tactics |
|
If this code is not reported by Windows then mapping it to nothing is a better fix. Just because the code sounds like the right answer, if Windows isn't reporting it, we shouldn't from macOS either. |
| else if (CFEqual(keyString, CFSTR("MissingIntermediate"))) | ||
| *pStatus |= PAL_X509ChainPartialChain; | ||
| else if (CFEqual(keyString, CFSTR("UnparseableExtension"))) | ||
| *pStatus |= PAL_X509ChainInvalidExtension; |
There was a problem hiding this comment.
The InvalidAia test must be changed to show that this code is reported by both Windows and macOS (and, ideally, Linux),
There was a problem hiding this comment.
We tried to add assert that, but it failed on windows, didn't checked on Linux
Assert.Contains(chain.ChainStatus, (status) => status.Status.HasFlag(X509ChainStatusFlags.InvalidExtension));
bartonjs
left a comment
There was a problem hiding this comment.
Shouldn't be merged into release/3.0 without confirmation it's decreasing, vs increasing, Windows behavior deltas.
|
Thanks @bartonjs |
You mean ignoring it better for now?
I might didn't get this comment correctly. If we check this status in |
Sure i will put back the tag after getting approval from @bartonjs
Yes It is not failing in 2.x. no need to port |
|
@buyaa-n are you sure it's not supported on Windows vs current implementation ignoring the code? |
|
@krwq I was not sure, thats why i asked about it from you at lunch, but haven't checked windows code yet |
|
@buyaa-n Windows does this: https://github.com/dotnet/corefx/blob/master/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/ChainPal.BuildChain.cs#L75 so you will need to read https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certgetcertificatechain to figure out if there is some easy way to get the error |
|
@bartonjs I have compared
Mac produces:
And if i map new status
So the correct mapping must be |
|
@bartonjs added test case is failing for Linux and old Mac OS, seems better remove the test case |
No, OfflineRevocation is a different code (and I'm surprised Windows is returning it). Windows might be returning it as a way of saying "due to inputs I couldn't complete this operation", but generally it means "you used X509RevocationMode.Offline and this value isn't in the cache". If it was an extension other than Authority Information Access we'd probably see different results.
I don't see the test case as part of this PR. Based on the data in this thread I believe the correct action is to map it to nothing. It might make sense to just make the test say it doesn't care about revocation (since it doesn't): X509Chain chain = new X509Chain();
+ chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
Assert.False(chain.Build(ee));Then we'll reduce the red herring of OfflineRevocation, and we can then just add Assert.Equals(1, chain.ChainElements.Count);
+ Assert.Equals(X509ChainStatusFlags.PartialChain, chain.AllStatusFlags()); |
|
@bartonjs updated accordingly, please re review |
bartonjs
left a comment
There was a problem hiding this comment.
LGTM (as long as the test run backs up my assertions).
oops, sorry forgot that, added ask mode, even its too late now, in case its not approved maybe raise reverse PR?
Yes i'm having that ready, just left all tests run again, will raise PR after this one got approved |
Unfortunately, no it wasn't. I'll bring it up at the next shiproom to see if they wouldn't have approved it. And if so, if we should back it out. But let's wait for shiproom approval for any future changes in 3.0. |
|
This was approved in shiproom today since it affects macOS 10.15. |
|
Thank you @eerhardt |
* [release/3.0]Handle `UnparseableExtension` status code when building X509Chain on … (#40117) Ignore `UnparseableExtension` status code when building X509Chain on OSX * [release/3.0] Update dependencies from 3 repositories (#40308) * Update dependencies from https://github.com/dotnet/core-setup build 20190814.02 - Microsoft.NETCore.App - 3.0.0-preview9-19414-02 - Microsoft.NETCore.DotNetHostPolicy - 3.0.0-preview9-19414-02 - Microsoft.NETCore.DotNetHost - 3.0.0-preview9-19414-02 * Update dependencies from https://github.com/dotnet/arcade build 20190812.7 - Microsoft.DotNet.XUnitExtensions - 2.4.1-beta.19412.7 - Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.19412.7 - Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19412.7 - Microsoft.DotNet.ApiCompat - 1.0.0-beta.19412.7 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19412.7 - Microsoft.DotNet.Build.Tasks.Configuration - 1.0.0-beta.19412.7 - Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19412.7 - Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19412.7 - Microsoft.DotNet.CodeAnalysis - 1.0.0-beta.19412.7 - Microsoft.DotNet.CoreFxTesting - 1.0.0-beta.19412.7 - Microsoft.DotNet.GenAPI - 1.0.0-beta.19412.7 - Microsoft.DotNet.GenFacades - 1.0.0-beta.19412.7 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19412.7 - Microsoft.DotNet.RemoteExecutor - 1.0.0-beta.19412.7 * Update dependencies from https://github.com/dotnet/standard build 20190814.3 - NETStandard.Library - 2.1.0-prerelease.19414.3 * fixing ZipPackagePart.GetStreamCore crashes with NotSupportedException (#40355) ZipArchiveEntry only ever supports opening once when the backing archive is in Create mode, and the backing stream is non-seekable, so we shouldn't call SetLength in that case. You could still open an archive in Update mode then call part.GetStream(FileMode.Create), in which case we'll want this call to SetLength, so we only avoid this call when the backing Archive is in Create mode. updating test to explicitly test the Update path for ZipPackage skip UAP since we don't have access to the file system to create the .zip undo accidental change to existing test removing unnecessary variable * Support custom converters that treat non-null input as null (#40287) (#40357)
Fixes #39988
Port of #40063
Description
Handle
UnparseableExtensionstatus code when building X509Chain on OSX 10.15Impact
Allow building X509Chain to support
UnparseableExtensionstatus and gracefully fail on latest OSXRegression?
No
Risk
Low