Skip to content

Commit 1e20b7b

Browse files
authored
Backport macOS 26 Tahoe test fixes to release/8.0-staging
Backport #118652 Backport #118777
1 parent 50eb246 commit 1e20b7b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public static partial class PlatformDetection
4343
public static bool IsNotMacOsAppleSilicon => !IsMacOsAppleSilicon;
4444
public static bool IsAppSandbox => Environment.GetEnvironmentVariable("APP_SANDBOX_CONTAINER_ID") != null;
4545
public static bool IsNotAppSandbox => !IsAppSandbox;
46+
public static bool IsApplePlatform26OrLater => IsOSXLike && Environment.OSVersion.Version.Major >= 26;
4647

4748
// RedHat family covers RedHat and CentOS
4849
public static bool IsRedHatFamily => IsRedHatFamilyAndVersion();

src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ public static void SystemTrustCertificateWithCustomRootTrust(bool addCertificate
288288

289289
// Check some known conditions.
290290

291-
if (PlatformDetection.UsesAppleCrypto)
291+
if (OperatingSystem.IsLinux() || PlatformDetection.IsApplePlatform26OrLater)
292292
{
293-
Assert.Equal(3, chain.ChainElements.Count);
293+
Assert.Equal(2, chain.ChainElements.Count);
294294
}
295-
else if (OperatingSystem.IsLinux())
295+
else if (PlatformDetection.IsOSXLike)
296296
{
297-
Assert.Equal(2, chain.ChainElements.Count);
297+
Assert.Equal(3, chain.ChainElements.Count);
298298
}
299299
}
300300
}
@@ -1179,12 +1179,12 @@ public static void BuildChainForCertificateSignedWithDisallowedKey()
11791179
chain.ChainPolicy.ExtraStore.Add(intermediateCert);
11801180
Assert.False(chain.Build(cert));
11811181

1182-
if (PlatformDetection.IsAndroid)
1182+
if (PlatformDetection.IsAndroid || PlatformDetection.IsApplePlatform26OrLater)
11831183
{
11841184
// Android always validates trust as part of building a path,
11851185
// so violations comes back as PartialChain with no elements
1186+
// Apple 26 no longer block these SKIs since the roots are no longer trusted at all and are expired.
11861187
Assert.Equal(X509ChainStatusFlags.PartialChain, chain.AllStatusFlags());
1187-
Assert.Equal(0, chain.ChainElements.Count);
11881188
}
11891189
else
11901190
{

0 commit comments

Comments
 (0)