Skip to content

Commit 371c2bf

Browse files
authored
Merge pull request #2514 from microsoft/dpaul-HcNullAdSchemaClass
Handle if results from AdSchemaInfo is null
2 parents e25774b + 8a29354 commit 371c2bf

2 files changed

Lines changed: 29 additions & 22 deletions

File tree

Diagnostics/HealthChecker/Analyzer/Security/Invoke-AnalyzerSecurityCve-2021-34470.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ function Invoke-AnalyzerSecurityCve-2021-34470 {
4343
TestVulnerabilitiesByBuildNumbersForDisplay -ExchangeBuildRevision "$($SecurityObject.ExchangeInformation.BuildInformation.ExchangeSetup.FileBuildPart).$($SecurityObject.ExchangeInformation.BuildInformation.ExchangeSetup.FilePrivatePart)" -SecurityFixedBuilds "1497.23" -CVENames "CVE-2021-34470"
4444
}
4545

46-
if ($SecurityObject.OrgInformation.SecurityResults.CVE202134470.Unknown -or
46+
if ($null -eq $SecurityObject.OrgInformation.SecurityResults.CVE202134470 -or
47+
$SecurityObject.OrgInformation.SecurityResults.CVE202134470.Unknown -or
4748
$SecurityObject.OrgInformation.SecurityResults.CVE202134470.IsVulnerable.ToString() -eq "Unknown") {
4849
Write-Verbose "Unable to query classSchema: 'ms-Exch-Storage-Group' information"
4950
$details = "CVE-2021-34470`r`n`t`tWarning: Unable to query classSchema: 'ms-Exch-Storage-Group' to perform testing."

Diagnostics/HealthChecker/DataCollection/OrganizationInformation/Invoke-JobOrganizationInformation.ps1

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -241,32 +241,38 @@ function Invoke-JobOrganizationInformation {
241241
Invoke-CatchActions
242242
}
243243

244-
$schemaRangeUpper = (
245-
($adSchemaInformation.msExchSchemaVersionPt.Properties["RangeUpper"])[0]).ToInt32([System.Globalization.NumberFormatInfo]::InvariantInfo)
244+
$CVE202221978Results = $null
245+
$CVE202134470Results = $null
246+
# Only execute if we were able to return the information from the schema class.
247+
if ($null -ne $adSchemaInformation.msExchSchemaVersionPt) {
246248

247-
if ($schemaRangeUpper -lt 15323) {
248-
$schemaLevel = "2013"
249-
} elseif ($schemaRangeUpper -lt 17000) {
250-
$schemaLevel = "2016"
251-
} else {
252-
$schemaLevel = "2019"
253-
}
249+
$schemaRangeUpper = (
250+
($adSchemaInformation.msExchSchemaVersionPt.Properties["RangeUpper"])[0]).ToInt32([System.Globalization.NumberFormatInfo]::InvariantInfo)
254251

255-
$cve21978Params = @{
256-
DomainsAcls = $domainsAclPermissions
257-
ExchangeWellKnownSecurityGroups = $wellKnownSecurityGroups
258-
ExchangeSchemaLevel = $schemaLevel
259-
SplitADPermissions = $isSplitADPermissions
260-
}
252+
if ($schemaRangeUpper -lt 15323) {
253+
$schemaLevel = "2013"
254+
} elseif ($schemaRangeUpper -lt 17000) {
255+
$schemaLevel = "2016"
256+
} else {
257+
$schemaLevel = "2019"
258+
}
261259

262-
$cve34470Params = @{
263-
MsExchStorageGroup = $adSchemaInformation.MsExchStorageGroup
260+
$cve21978Params = @{
261+
DomainsAcls = $domainsAclPermissions
262+
ExchangeWellKnownSecurityGroups = $wellKnownSecurityGroups
263+
ExchangeSchemaLevel = $schemaLevel
264+
SplitADPermissions = $isSplitADPermissions
265+
}
266+
Get-SecurityCve-2022-21978 @cve21978Params | Invoke-RemotePipelineHandler -Result ([ref]$CVE202221978Results)
264267
}
265268

266-
$CVE202221978Results = $null
267-
$CVE202134470Results = $null
268-
Get-SecurityCve-2022-21978 @cve21978Params | Invoke-RemotePipelineHandler -Result ([ref]$CVE202221978Results)
269-
Get-SecurityCve-2021-34470 @cve34470Params | Invoke-RemotePipelineHandler -Result ([ref]$CVE202134470Results)
269+
if ($null -ne $adSchemaInformation.MsExchStorageGroup) {
270+
$cve34470Params = @{
271+
MsExchStorageGroup = $adSchemaInformation.MsExchStorageGroup
272+
}
273+
274+
Get-SecurityCve-2021-34470 @cve34470Params | Invoke-RemotePipelineHandler -Result ([ref]$CVE202134470Results)
275+
}
270276

271277
$securityResults = [PSCustomObject]@{
272278
CVE202221978 = $CVE202221978Results

0 commit comments

Comments
 (0)