Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[release/2.1] Handle additional chain statuses for X509Chain on macOS#42916

Closed
vcsjones wants to merge 4 commits intodotnet:release/2.1from
vcsjones:port-macos-chain-statuses-21
Closed

[release/2.1] Handle additional chain statuses for X509Chain on macOS#42916
vcsjones wants to merge 4 commits intodotnet:release/2.1from
vcsjones:port-macos-chain-statuses-21

Conversation

@vcsjones
Copy link
Member

@vcsjones vcsjones commented May 1, 2020

Ports the following PRs in to the release/2.1 branch.

This omits the unit tests from 35347 because the tests depend on new functionality not present in the release/2.1 branch.

This omits the unit test changes from 40117 because that test does not exist in release/2.1

Description

X509Chain.Build can receive unknown status strings from the underlying platform, macOS, when building an X509 chain. An unknown status string causes a CryptographicException to be thrown due to the missing mappings.

The fix is to correctly handle these additional statuses, mapping them such that the behavior matches what Windows and Linux do.

Customer Impact

Initially reported by a customer in dotnet/runtime#35238. Customers that attempt to build an X509Chain on macOS with a certificate that causes one of the unknown statuses to be triggered will receive a CryptographicException instead of the X509ChainStatusFlags which other platforms correctly report. This may cause compatibility issues as developers are porting from other platforms to macOS.

Regression

No.

Testing

Contains unit tests for all but the basic constraints scenario due to missing functionality in release 2.1 to aid testing. All are tested in dotnet/runtime.

Risk

Low. All of the new codes have been encountered in testing and measured against Windows for cross-platform consistency. The existing tests ensure that the change isn't accidentally doing subtle remaps of established values.

vcsjones and others added 4 commits April 28, 2020 15:25
macOS can return additional chain status strings for a certificate that
was issued by a certificate that violated its basic constraints.

If a leaf certificate is issued from a certificate with CA:FALSE,
the strings BasicConstraintsCA and BasicConstraintsPathLen are
reported. We map these the same for BasicConstraints.
MacOS returns a different status string for certificates that are in a special
database that are explicitly distrusted. Windows has similar behavior, which
reports the certificates as PAL_X509ChainExplicitDistrust. This makes macOS
do the same instead of throwing an exception.

Linux does not appear to have any special distrusting for these
certificates.
* Support unknown critical extensions on macOS.

If a certificate contains an unprocessable critical extension
in a certificate, map the "CriticalExtensions" status to
HasNotSupportedCriticalExtension instead of throwing an exception.

* Ignore WeakSignature chain status on macOS.

X509Chain on Windows will not check for modern signatures, so we
will let macOS do the same thing.
@vcsjones
Copy link
Member Author

vcsjones commented May 1, 2020

@bartonjs I optimistically opened this PR for consideration based on #42914. Feel free to close if it is premature.

It is identical to the other PR, with one additional commit to include the "UnparseableExtension" status.

@danmoseley
Copy link
Member

@bartonjs which do you prefer? I guess I'd assume the fuller one.

@bartonjs
Copy link
Member

bartonjs commented May 2, 2020

@danmosemsft Yeah, I'd advocate just doing the full catch-up and have the same translation table for all three main branches.

@danmoseley
Copy link
Member

Ok

@danmoseley danmoseley added Servicing-consider Issue for next servicing release review Servicing-rejected and removed Servicing-consider Issue for next servicing release review labels May 5, 2020
@danmoseley
Copy link
Member

See note in #42914

If new impact emerges, we can take another look. It would likely involve official support tickets.

@danmoseley danmoseley closed this May 5, 2020
@danmoseley
Copy link
Member

Thanks @vcsjones for working on these.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants