Modules/ScubaConfig/ScubaConfig.psm1
|
using module '.\ScubaConfigValidator.psm1' class ScubaConfig { <# .SYNOPSIS ScubaConfig is a class that provides validation to ScubaGear YAML/JSON configuration files .DESCRIPTION ScubaConfig implements a singleton configuration management class that manages configuration state throughout the PowerShell session. It integrates tightly with ScubaConfigValidator to provide validation using JSON Schema and default rules. .EXAMPLE # Basic usage - Get singleton instance and load configuration using module '.\ScubaConfig.psm1' $Config = [ScubaConfig]::GetInstance() $Success = $Config.LoadConfig("C:\MyConfig\scuba-config.yaml") if ($Success) { $ConfigObject = $Config.Configuration # Inspect the loaded configuration $ConfigObject } .EXAMPLE # Access default values and configuration schema $DefaultOPAPath = [ScubaConfig]::ScubaDefault('DefaultOPAPath') $AllProducts = [ScubaConfig]::ScubaDefault('AllProductNames') $SupportedEnvironments = [ScubaConfig]::GetSupportedEnvironments() #> # Static properties for singleton instance and cached resources # Singleton pattern ensures only one configuration instance exists per PowerShell session hidden static [ScubaConfig]$_Instance = [ScubaConfig]::new() # Track whether a configuration file has been successfully loaded hidden static [Boolean]$_IsLoaded = $false # Track whether the validator subsystem has been initialized hidden static [Boolean]$_ValidatorInitialized = $false # Cached configuration defaults loaded from JSON file hidden static [object]$_ConfigDefaults = $null # Cached JSON schema used for validation hidden static [object]$_ConfigSchema = $null [Boolean]$M365EnvironmentProvided = $false # Initializes validator subsystem once per session - loads schemas/defaults from JSON files, # caches resources in static properties for performance. # This is called automatically when needed and uses lazy loading pattern static [void] InitializeValidator() { # Only initialize if not already done (singleton initialization) if (-not [ScubaConfig]::_ValidatorInitialized) { # Get the directory containing this module file $ModulePath = Split-Path -Parent $PSCommandPath # Initialize the validator with the module path [ScubaConfigValidator]::Initialize($ModulePath) # Cache the loaded defaults and schema for fast access [ScubaConfig]::_ConfigDefaults = [ScubaConfigValidator]::GetDefaults() [ScubaConfig]::_ConfigSchema = [ScubaConfigValidator]::GetSchema() # Mark as initialized to prevent duplicate initialization [ScubaConfig]::_ValidatorInitialized = $true } } # Resolves configuration defaults using naming conventions. "Default" prefix maps to defaults section. # Special processing: DefaultOPAPath expands ~, DefaultOutPath resolves ., wildcard handling for products. # This method provides a unified interface for accessing default values with automatic path resolution static [object]ScubaDefault ([string]$Name){ # Ensure validator is initialized before accessing cached defaults [ScubaConfig]::InitializeValidator() # Dynamically resolve configuration values based on naming conventions # This eliminates the need to maintain static mappings in multiple places # and makes the system more maintainable # Handle special cases that require path processing or expansion if ($Name -eq 'DefaultOPAPath') { # Get the raw path from defaults configuration $Path = [ScubaConfig]::_ConfigDefaults.defaults.OPAPath # Expand tilde (~) to user's home directory if present if ($Path -eq "~/.scubagear/Tools") { try { # Convert Unix-style path to Windows path in user's profile $ExpandedPath = Join-Path -Path $env:USERPROFILE -ChildPath ".scubagear\Tools" # Check if expanded path exists, fallback to current directory if not if (Test-Path -LiteralPath $ExpandedPath) { return $ExpandedPath } else { # Fallback to current directory (legacy behavior when OPA not installed) return "." } } catch { # Fallback to current directory if home directory expansion fails return "." } } return $Path } elseif ($Name -eq 'DefaultOutPath') { $Path = [ScubaConfig]::_ConfigDefaults.defaults.OutPath if ($Path -eq ".") { return Get-Location | Select-Object -ExpandProperty ProviderPath } return $Path } elseif ($Name -eq 'AllProductNames') { return [ScubaConfig]::_ConfigDefaults.defaults.AllProductNames } elseif ($Name -eq 'DefaultPrivilegedRoles') { return [ScubaConfig]::_ConfigDefaults.privilegedRoles } elseif ($Name -eq 'AuthenticationClientIdHashtable') { $ClientIdHash = @{} foreach ($Property in [ScubaConfig]::_ConfigDefaults.AuthenticationClientIdHashtable.PSObject.Properties) { $ClientIdHash[$Property.Name] = [string]$Property.Value } return $ClientIdHash } elseif ($Name.StartsWith('Default')) { # For standard "Default" prefixed names, auto-resolve from defaults section $ConfigKey = $Name.Substring(7) # Remove 'Default' prefix # Check if the property exists in defaults if ([ScubaConfig]::_ConfigDefaults.defaults.PSObject.Properties.Name -contains $ConfigKey) { return [ScubaConfig]::_ConfigDefaults.defaults.$ConfigKey } else { throw "Unknown default configuration key: $Name. Property '$ConfigKey' not found in defaults section." } } else { # If no mapping found, throw error throw "Unknown default configuration key: $Name. Available keys: $((Get-Member -InputObject [ScubaConfig]::_ConfigDefaults -MemberType NoteProperty).Name -join ', ')" } } # Returns default OPA version from configuration. Wrapper around ScubaDefault('DefaultOPAVersion'). static [string]GetOpaVersion() { return [ScubaConfig]::ScubaDefault('DefaultOPAVersion') } static [array]GetCompatibleOpaVersions() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigDefaults.metadata.compatibleOpaVersions } static [string] GetOpaExecutable([string]$OperatingSystem) { [ScubaConfig]::InitializeValidator() if ([string]::IsNullOrWhiteSpace($OperatingSystem)) { throw "OperatingSystem parameter cannot be null or whitespace." } $OPAExecutables = [ScubaConfig]::_ConfigDefaults.defaults.OPAExecutable if ($null -eq $OPAExecutables) { throw "OPAExecutable default configuration does not exist." } $validKeys = @($OPAExecutables.PSObject.Properties.Name) $requestedKey = $OperatingSystem.Trim().ToLower() $matchedKey = $validKeys | Where-Object { $_.ToLower() -eq $requestedKey } | Select-Object -First 1 if (-not $matchedKey) { throw "No OPA executable found for operating system: $OperatingSystem" } return $OPAExecutables.$matchedKey } # Loads configuration file with full validation enabled (delegates to main LoadConfig with SkipValidation=false). [Boolean]LoadConfig([System.IO.FileInfo]$Path){ return $this.LoadConfig($Path, $false) } # Primary config loading method. Resets singleton, validates file format, parses content, applies defaults. # SkipValidation=true allows deferred validation after command-line overrides are applied. # This method implements a two-phase validation approach for flexibility: # Phase 1: Always validate file format (extension, size, YAML syntax) # Phase 2: Optionally validate content (schema, Scuba configuration rules) based on SkipValidation parameter [Boolean]LoadConfig([System.IO.FileInfo]$Path, [Boolean]$SkipValidation){ # First, verify the file exists before attempting to load it # This provides a clear error message rather than letting file operations fail later if (-Not (Test-Path -PathType Leaf $Path)){ throw [System.IO.FileNotFoundException]"Failed to load: $Path" } # Reset the singleton to ensure clean state before loading new configuration # This prevents contamination from previously loaded configurations in the same session [ScubaConfig]::ResetInstance() # Ensure the validator subsystem is ready [ScubaConfig]::InitializeValidator() # Phase 1: Always validate basic file format (extension, size, YAML syntax) # This catches fundamental issues early before processing Write-Debug "Loading configuration file: $Path" # Use the default debug mode from configuration instead of hardcoding false # This allows the debug behavior to be controlled via configuration files $Defaults = [ScubaConfig]::_ConfigDefaults $DefaultDebugMode = if ($Defaults.outputSettings -and $Defaults.outputSettings.debugMode) { $Defaults.outputSettings.debugMode } else { $false } Write-Debug "Using debug mode: $DefaultDebugMode (from configuration default)" # Perform initial validation with Scuba configuration rules skipped (SkipScubaConfigRules=true) # This validates file format, extension, size, and YAML parsing but defers content validation # Schema and content validation happen later in ValidateConfiguration() $ValidationResult = [ScubaConfigValidator]::ValidateYamlFile($Path.FullName, $DefaultDebugMode, $true) # Check for file format errors (extension, size, YAML parsing) # These are fundamental issues that prevent any further processing if (-not $ValidationResult.IsValid) { # Build error message with simple bullet list (no categorization for format errors) $Plural = if ($ValidationResult.ValidationErrors.Count -ne 1) { 's' } else { '' } $ErrorMessage = "Configuration file format validation failed ($($ValidationResult.ValidationErrors.Count) error$Plural):`n" foreach ($ErrorMsg in $ValidationResult.ValidationErrors) { $ErrorMessage += " - $ErrorMsg`n" } throw $ErrorMessage } # Display warnings if any (file size approaching limits, deprecated formats, etc.) # Warnings don't prevent loading but provide important user guidance if ($ValidationResult.Warnings.Count -gt 0) { foreach ($Warning in $ValidationResult.Warnings) { Write-Warning $Warning } } # Use the already parsed content from validation to avoid re-parsing # The validator has already converted YAML to PowerShell objects safely $this.Configuration = $ValidationResult.ParsedContent # Properties that solely host a YAML anchor definition $this.AnchorDefinedProperties = $ValidationResult.AnchorDefinedProperties # IMPORTANT: Validate required fields BEFORE converting to hashtable # PSCustomObject preserves case-sensitive property names, hashtable doesn't # This ensures minRequired check validates exact property names from YAML if (-not $SkipValidation) { [ScubaConfig]::ValidateRequiredFields($this.Configuration) } # Convert to hashtable for compatibility with internal configuration management # PSCustomObjects from YAML parsing need to be converted to hashtables for consistent access patterns # Note: Hashtables are case-insensitive, which is why we validate BEFORE conversion if ($this.Configuration -is [PSCustomObject]) { $this.Configuration = [ScubaConfig]::ConvertPSObjectToHashtable($this.Configuration) } $this.M365EnvironmentProvided = $this.Configuration.ContainsKey('M365Environment') # Apply default values and process special configuration properties # This ensures all required properties have values for subsequent processing # Handles wildcards, path expansion (including OPAPath fallback to current directory) $this.SetParameterDefaults() # Perform full content validation AFTER applying defaults # This validates the complete configuration with all applied # Includes OPA executable existence check which needs the expanded/fallback OPAPath if (-not $SkipValidation) { # Validate the complete configuration including schema, Scuba configuration rules, and policy references $this.ValidateConfiguration() } # Mark configuration as successfully loaded [ScubaConfig]::_IsLoaded = $true return [ScubaConfig]::_IsLoaded } # Validates that required fields are present in configuration BEFORE defaults are applied # This prevents minRequired validation from being bypassed by default values # Issues warning if any required field is missing (schema-driven from defaults.json minRequired) # Takes PSCustomObject to preserve case-sensitive property names (hashtable is case-insensitive) static [void] ValidateRequiredFields([PSCustomObject]$ConfigObject) { [ScubaConfig]::InitializeValidator() $Defaults = [ScubaConfig]::_ConfigDefaults if (-not $Defaults.minRequired) { return } $MissingFields = @() foreach ($RequiredField in $Defaults.minRequired) { # Check if property exists (case-sensitive for exact match) # PSCustomObject preserves exact case from YAML, unlike hashtable which is case-insensitive $PropertyNames = @($ConfigObject.PSObject.Properties.Name) if ($RequiredField -cnotin $PropertyNames) { # Also check case-insensitive to provide helpful case mismatch warnings $FoundCaseInsensitive = $false foreach ($PropName in $PropertyNames) { if ($PropName.ToLower() -eq $RequiredField.ToLower()) { $FoundCaseInsensitive = $true Write-Warning "Required property '$RequiredField' found with incorrect case: '$PropName'. Recommended using exact case: '$RequiredField'." # Case-insensitive match found - don't add to missing fields break } } if (-not $FoundCaseInsensitive) { $MissingFields += $RequiredField } } } if ($MissingFields.Count -gt 0) { $Plural = if ($MissingFields.Count -ne 1) { 's' } else { '' } $WarningMessage = "Configuration validation warning ($($MissingFields.Count) warning$Plural):`n" foreach ($Field in $MissingFields) { $WarningMessage += " - Required property '$Field' is missing.`n" } $WarningMessage += "`n--- RECOMMENDED ACTION ---`n" $WarningMessage += " - It is recommended to use the new ScubaGear Configuration Editor to build a configuration file.`n" $WarningMessage += " - Run: 'Start-ScubaConfigApp' to launch the configuration application.`n" Write-Warning $WarningMessage } } # Validates current configuration state after overrides. Performs schema + Scuba configuration rules + policy validation. # Used for deferred validation pattern where config is loaded with SkipValidation=true then validated after overrides. # This allows command-line parameters to override config file values before final validation. # The method implements a comprehensive validation strategy with multiple phases and detailed error reporting. [void]ValidateConfiguration(){ Write-Debug "Validating final configuration state" # Convert internal hashtable representation back to PSCustomObject for validator compatibility # The validator expects PSCustomObject format for consistent property access across different PowerShell object types # This conversion is necessary because the internal configuration uses hashtables for performance $ConfigObject = [PSCustomObject]$this.Configuration # Phase 1: Perform JSON Schema validation (structure, types, constraints) # This validates against the formal schema definition including data types, patterns, and structural requirements # Schema validation catches fundamental issues like wrong data types, missing required fields, invalid formats $SchemaValidation = [ScubaConfigValidator]::ValidateAgainstSchema($ConfigObject, $false, $this.AnchorDefinedProperties) # Phase 2: Perform Scuba configuration rule validation (paths, content quality, cross-field validation) # This layer adds domain-specific validation beyond what JSON Schema can express # Scuba configuration rules include file path existence, cross-field dependencies, and ScubaGear-specific requirements $ScubaConfigValidation = [ScubaConfigValidator]::ValidateScubaConfigRules($ConfigObject, $false) # Collect all warnings from initial validation phases # We'll display them later after collecting policy validation warnings too $AllWarnings = @() # Include pre-validation warnings (e.g., wildcard with other products) if ($this.Configuration.ContainsKey('_PreValidationWarnings')) { $AllWarnings += $this.Configuration._PreValidationWarnings } $AllWarnings += $SchemaValidation.Warnings $AllWarnings += $ScubaConfigValidation.Warnings # Collect all errors from both validation phases (remove duplicates) # This provides a comprehensive view of all configuration issues in a single validation run $AllErrors = @() $AllErrors += $SchemaValidation.Errors $AllErrors += $ScubaConfigValidation.Errors $AllErrors = $AllErrors | Select-Object -Unique # Validate policy-type properties (dynamically discovered from schema) # This validates any property that contains policy IDs (like OmitPolicy, AnnotatePolicy) # added to the schema will be automatically validated here $Schema = [ScubaConfig]::_ConfigSchema if ($Schema.properties) { foreach ($PropertyName in $Schema.properties.PSObject.Properties.Name) { $PropertySchema = $Schema.properties.$PropertyName # Check if this is a policy-type property (has patternProperties with policy ID pattern and oneOf) if ([ScubaConfigValidator]::IsPolicyTypeProperty($PropertyName, $PropertySchema)) { # Check if this property exists in the configuration if ($this.Configuration.ContainsKey($PropertyName)) { Write-Debug "Validating policy-type property: $PropertyName" # Validate using the generic policy configuration validator $PolicyValidation = [ScubaConfig]::ValidatePolicyConfiguration( $this.Configuration[$PropertyName], $PropertyName, $this.Configuration.ProductNames ) $AllWarnings += $PolicyValidation.Warnings $AllErrors += $PolicyValidation.Errors } } } } # Remove duplicate warnings (policy validation may overlap with other validations) $AllWarnings = $AllWarnings | Select-Object -Unique # Display all warnings if any were collected (with categorization and recommended actions) if ($AllWarnings.Count -gt 0) { $WarningPlural = if ($AllWarnings.Count -ne 1) { 's' } else { '' } $WarningMessage = "Configuration validation found $($AllWarnings.Count) warning$WarningPlural`:`n" # Categorize warnings using the CategorizeMessages method $CategorizedResult = [ScubaConfigValidator]::CategorizeMessages($AllWarnings, 'warning') foreach ($Warning in $CategorizedResult.CategorizedMessages) { $WarningMessage += " $Warning`n" } # Display recommended actions for warnings if ($CategorizedResult.ActionMessageRefs.Count -gt 0) { $Defaults = [ScubaConfigValidator]::GetDefaults() if ($Defaults.outputSettings -and $Defaults.outputSettings.recommendedActionMessages) { $WarningMessage += "`n--- RECOMMENDED ACTION ---`n" foreach ($ActionRef in $CategorizedResult.ActionMessageRefs) { if ($Defaults.outputSettings.recommendedActionMessages.$ActionRef) { $WarningMessage += " - $($Defaults.outputSettings.recommendedActionMessages.$ActionRef)`n" $WarningMessage += "`n" # Add extra newline between different action message groups for readability } } } } Write-Warning $WarningMessage } # Remove duplicate errors $AllErrors = $AllErrors | Select-Object -Unique # If any validation errors were found, throw a comprehensive error message # This prevents execution with invalid configuration and provides clear guidance for remediation if ($AllErrors.Count -gt 0) { # Categorize errors for better organization and get recommended action message refs $CategorizationResult = [ScubaConfigValidator]::CategorizeErrors($AllErrors) # Build complete error message with categorized errors $Plural = if ($AllErrors.Count -ne 1) { 's' } else { '' } $ErrorMessage = "Configuration validation failed ($($AllErrors.Count) error$Plural):`n" foreach ($ErrorLine in $CategorizationResult.CategorizedErrors) { $ErrorMessage += "$ErrorLine`n" } # Add recommended action messages based on actionMessageRefs from error categorization if ($CategorizationResult.ActionMessageRefs.Count -gt 0) { $ErrorMessage += "`n--- RECOMMENDED ACTION ---`n" # Track if we've added any messages to control spacing $MessagesAdded = $false # Sort actionMessageRefs to ensure "default" is always last $SortedRefs = $CategorizationResult.ActionMessageRefs | Sort-Object -Property @{ Expression = { if ($_ -eq 'default') { 1 } else { 0 } } } # Add recommended action messages in sorted order (unique refs, default last) foreach ($Ref in $SortedRefs) { if ([ScubaConfig]::_ConfigDefaults.outputSettings.recommendedActionMessages.$Ref) { # Add blank line between different message groups if ($MessagesAdded) { $ErrorMessage += "`n" } foreach ($Line in [ScubaConfig]::_ConfigDefaults.outputSettings.recommendedActionMessages.$Ref) { $ErrorMessage += "$Line`n" } $MessagesAdded = $true } } } throw $ErrorMessage } } # Clears configuration data from singleton instance. Used by ResetInstance() for clean state. hidden [void]ClearConfiguration(){ $this.Configuration = $null $this.AnchorDefinedProperties = @() } # Recursively converts PSCustomObject to hashtable for internal storage compatibility. # YAML parsing creates PSCustomObjects, but internal config uses hashtables for performance. # This conversion is necessary because: # 1. Hashtables provide faster property access than PSCustomObjects # 2. Hashtables have more predictable behavior with dynamic property names # 3. Legacy ScubaGear code expects hashtable interface for configuration access # 4. Hashtables work better with PowerShell's automatic variable expansion hidden static [hashtable] ConvertPSObjectToHashtable([PSCustomObject]$Object) { $Hashtable = @{} # Process each property from the PSCustomObject foreach ($Property in $Object.PSObject.Properties) { # Recursively convert nested PSCustomObjects to nested hashtables # This handles complex configuration structures like exclusion policies if ($Property.Value -is [PSCustomObject]) { $Hashtable[$Property.Name] = [ScubaConfig]::ConvertPSObjectToHashtable($Property.Value) } # Handle arrays that might contain PSCustomObjects (like ProductNames with complex structures) # Arrays in YAML can contain both simple values and complex objects elseif ($Property.Value -is [Array] -or $Property.Value -is [System.Collections.IList]) { $Array = @() foreach ($Item in $Property.Value) { # Convert any PSCustomObjects within the array to hashtables if ($Item -is [PSCustomObject]) { $Array += [ScubaConfig]::ConvertPSObjectToHashtable($Item) } else { # Keep primitive types (strings, numbers, booleans) as-is $Array += $Item } } $Hashtable[$Property.Name] = $Array } else { # For primitive types (string, int, bool), copy directly # No conversion needed for these basic data types $Hashtable[$Property.Name] = $Property.Value } } return $Hashtable } # Validates policy configuration entries for format compliance, product alignment, and schema compliance. # This method ensures that OmitPolicy and AnnotatePolicy sections contain valid policy IDs, # reference products selected for scanning, and have properly formatted values per the schema. # Policy IDs must follow the format: MS.{PRODUCT}.{GROUP}.{NUMBER}v{VERSION} # Returns a PSCustomObject with Errors and Warnings arrays hidden static [PSCustomObject] ValidatePolicyConfiguration([object]$PolicyConfig, [string]$ActionType, [array]$ProductNames) { [ScubaConfig]::InitializeValidator() $Defaults = [ScubaConfig]::_ConfigDefaults $Schema = [ScubaConfig]::_ConfigSchema $RequireProduct = $Defaults.validation.requireProductInPolicy $Result = [PSCustomObject]@{ Errors = @() Warnings = @() } # Get the schema definition for this action type (OmitPolicy or AnnotatePolicy) $PropertySchema = $null if ($Schema.properties -and $Schema.properties.$ActionType) { $PropertySchema = $Schema.properties.$ActionType } # Process each policy ID in the configuration section (OmitPolicy or AnnotatePolicy) foreach ($Policy in $PolicyConfig.Keys) { # Validate policy ID format against the regex pattern from configuration # Pattern ensures proper format: MS.{PRODUCT}.{GROUP}.{NUMBER}v{VERSION} # Example valid IDs: MS.AAD.1.1v1, MS.SECURITYSUITE.2.3v1, MS.EXO.1.4v1 if (-not ($Policy -match $Defaults.validation.policyIdPattern)) { # Try to extract product from malformed policy ID to provide helpful error message # Split on periods to get potential product name for better error guidance $PolicyParts = $Policy -split "\." $ProductInPolicy = if ($PolicyParts.Length -ge 2 -and $PolicyParts[1]) { $PolicyParts[1] } else { $null } # Generate user-friendly format example using the validator's helper method # This provides context-specific guidance (e.g., "MS.AAD.#.#v#" if product detected) $ExampleFormat = [ScubaConfigValidator]::ConvertPatternToExample($Defaults.validation.policyIdPattern, $ProductInPolicy) # Build contextual error message based on the action type $Message = "${ActionType}: '$Policy' is not a valid policy ID. Expected format: $ExampleFormat." if ($RequireProduct) { $Result.Errors += $Message } else { $Result.Warnings += $Message } continue } # Extract the product name from the policy ID (second component after splitting on periods) # Policy ID format: MS.{PRODUCT}.{GROUP}.{NUMBER}v{VERSION} # Convert to lowercase for case-insensitive comparison with ProductNames $Product = ($Policy -Split "\.")[1].ToLower() # Determine which products are effectively selected for scanning # Handle wildcard case where all products are selected $EffectiveProducts = $ProductNames if ($ProductNames -contains '*') { # Expand wildcard to all available products from configuration $EffectiveProducts = $Defaults.defaults.AllProductNames } # Verify that the referenced product is actually going to be scanned # Prevents configuration errors where policies are specified for products not being tested if (-not ($EffectiveProducts -Contains $Product)) { # Build message with proper action prefix and clear explanation $Message = "${ActionType}: '$Policy' references product '$Product' which is not in the selected ProductNames: $(($EffectiveProducts -join ', ').ToUpper())." if ($RequireProduct) { $Result.Errors += $Message } else { $Result.Warnings += $Message } } # Validate the policy value against the schema (Rationale/Expiration or Comment/RemediationDate/IncorrectResult) if ($PropertySchema -and $PropertySchema.patternProperties) { $PolicyValue = $PolicyConfig[$Policy] # Find the matching pattern schema for this policy ID $MatchedPatternSchema = $null foreach ($Pattern in $PropertySchema.patternProperties.PSObject.Properties.Name) { if ($Policy -match $Pattern) { $MatchedPatternSchema = $PropertySchema.patternProperties.$Pattern break } } if ($MatchedPatternSchema) { # Create a temporary validation object to collect schema validation errors $SchemaValidation = @{ Errors = [System.Collections.ArrayList]::new() Warnings = [System.Collections.ArrayList]::new() } # Validate the value against the pattern schema for this policy ID [ScubaConfigValidator]::ValidateItemAgainstSchema($PolicyValue, $MatchedPatternSchema, $SchemaValidation, "${ActionType}: '$Policy'") # Add schema validation errors/warnings to result based on requireProductInPolicy setting foreach ($ValidationError in $SchemaValidation.Errors) { if ($RequireProduct) { $Result.Errors += $ValidationError } else { $Result.Warnings += $ValidationError } } # Warnings from schema validation should always be warnings foreach ($Warning in $SchemaValidation.Warnings) { $Result.Warnings += $Warning } } } } return $Result } # Internal configuration storage as hashtable hidden [hashtable]$Configuration # Top-level property names (detected from the raw YAML text at load time) that solely # host a YAML anchor definition, e.g. 'SensitiveUsers: &CommonSensitiveUsers'. Retained # so deferred schema validation can exclude them from "unknown property" warnings. hidden [array]$AnchorDefinedProperties = @() # Applies default values and processes special configuration properties (wildcards, path expansion). # This method ensures all required properties have values and handles special cases like path resolution. # It implements a two-phase approach: 1) Apply defaults for missing properties, 2) Process special cases. hidden [void]SetParameterDefaults(){ Write-Debug "Setting ScubaConfig default values from configuration." # Get the defaults section from cached configuration # This contains fallback values for all configurable properties $Defaults = [ScubaConfig]::_ConfigDefaults.defaults # Phase 1: Apply default values for any properties not explicitly set in the configuration file # This ensures the configuration is complete even if the YAML file is minimal or missing properties # Iterate through all default properties and set any missing values foreach ($PropertyName in $Defaults.PSObject.Properties.Name) { # Only set default if the property wasn't explicitly provided in the configuration file # This respects user's explicit choices while filling in gaps with sensible defaults # An explicit boolean (including false) is a user's choice, not a missing value if ($this.Configuration.$PropertyName -isnot [bool] -and -not $this.Configuration.$PropertyName) { Write-Debug "Setting default value for '$PropertyName'" # Copy the default value from the defaults configuration $this.Configuration[$PropertyName] = $Defaults.$PropertyName } } # Phase 2: Special processing for properties that require additional logic beyond simple defaults # These properties need custom handling for wildcards, path resolution, or data transformation # Special handling for ProductNames (wildcard expansion and uniqueness) # ProductNames determines which Microsoft 365 products will be scanned if ($this.Configuration.ProductNames) { # Check for wildcard with other products before expansion # Store warning to display later with validation warnings for consistency # This is a common user mistake that can lead to confusion about which products are scanned if ($this.Configuration.ProductNames.Contains('*') -and $this.Configuration.ProductNames.Count -gt 1) { if (-not $this.Configuration.ContainsKey('_PreValidationWarnings')) { $this.Configuration._PreValidationWarnings = [System.Collections.ArrayList]::new() } [void]$this.Configuration._PreValidationWarnings.Add("ProductNames contains wildcard '*' with other products. Wildcard takes precedence.") } # Handle wildcard '*' by expanding to all supported products # This provides a convenient way to scan all available Microsoft 365 products if ($this.Configuration.ProductNames.Contains('*')) { $this.Configuration.ProductNames = [ScubaConfig]::ScubaDefault('AllProductNames') Write-Debug "Setting ProductNames to all products because of wildcard" } else { # Remove duplicates and sort for consistency # This handles cases where users accidentally specify the same product multiple times Write-Debug "ProductNames provided - ensuring uniqueness." $this.Configuration.ProductNames = @($this.Configuration.ProductNames | Sort-Object -Unique) } } # Special handling for OPAPath (expand Unix-style home directory reference) # Convert tilde (~) to actual Windows user profile path for cross-platform compatibility if ($this.Configuration.OPAPath -eq "~/.scubagear/Tools") { try { # Build the full path using Windows conventions # This allows Unix-style path notation to work on Windows systems $ExpandedPath = Join-Path -Path $env:USERPROFILE -ChildPath ".scubagear\Tools" # Check if expanded path exists, fallback to current directory if not (legacy behavior) if (Test-Path -LiteralPath $ExpandedPath) { $this.Configuration.OPAPath = $ExpandedPath } else { # Fallback to current directory when default OPA path doesn't exist # This matches legacy behavior for systems without OPA installed in the default location $this.Configuration.OPAPath = "." } } catch { # Fallback to current directory if profile path resolution fails # This ensures the configuration is still usable even if home directory access fails $this.Configuration.OPAPath = "." } } # Note: If OPAPath is explicitly set in config file (not the default), it will be used as-is # and validation will fail if OPA executable is not found there (no fallback for explicit paths) # Special handling for OutPath (resolve relative current directory reference) # Convert '.' to the actual current working directory path for absolute path consistency if ($this.Configuration.OutPath -eq ".") { # Get the current working directory as an absolute path # This ensures output files are written to a predictable location $this.Configuration.OutPath = Get-Location | Select-Object -ExpandProperty ProviderPath } return } # enforces singleton pattern by preventing direct instantiation. hidden ScubaConfig(){ } # Resets singleton to clean state. Primarily used in testing scenarios for isolation. static [void]ResetInstance(){ [ScubaConfig]::_Instance.ClearConfiguration() [ScubaConfig]::_IsLoaded = $false # Allow reinitialization of the validator when tests call ResetInstance [ScubaConfig]::_ValidatorInitialized = $false # Always: force cleanup for CI runs [GC]::Collect() [GC]::WaitForPendingFinalizers() return } # Returns the singleton instance. Initializes validator subsystem on first access. static [ScubaConfig]GetInstance(){ [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_Instance } # Returns configuration defaults object loaded from ScubaConfigDefaults.json. static [object] GetConfigDefaults() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigDefaults } # Returns JSON Schema object loaded from ScubaConfigSchema.json for configuration validation. static [object] GetConfigSchema() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigSchema } # Validates configuration file without loading it. Returns detailed validation results. static [ValidationResult] ValidateConfigFile([string]$Path) { [ScubaConfig]::InitializeValidator() return [ScubaConfigValidator]::ValidateYamlFile($Path) } # Returns array of all supported product names from defaults configuration. static [array] GetSupportedProducts() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigDefaults.defaults.AllProductNames } # Returns array of supported M365 environment names (commercial, gcc, gcchigh, dod). static [array] GetSupportedEnvironments() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigSchema.properties.M365Environment.enum } # Returns the default Scuba GitHub URL from the configuration schema. static [string] GetScubaGitHubUrl() { return [ScubaConfig]::ScubaDefault('DefaultScubaGitHubUrl') } # Returns array of all valid product names from the configuration schema. static [array] GetAllValidProductNames() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigSchema.properties.ProductNames.items.enum } # Returns the baseline name for a given product from the configuration schema. static [string] GetProductBaselineName([string]$ProductName) { [ScubaConfig]::InitializeValidator() # Retrieve the product information from the report product names in the configuration schema. $info = [ScubaConfig]::_ConfigSchema.schemaMetadata.reportProductNames.$ProductName # Throw an error if the product information is not found. if ($null -eq $info) { throw "Unknown product name: '$ProductName'" } return $info.baselineName } # Returns an array of all baseline names from the configuration schema. static [array] GetProductBaselineNames() { [ScubaConfig]::InitializeValidator() # Retrieve all baseline names from the report product names in the configuration schema. return [ScubaConfig]::_ConfigSchema.schemaMetadata.reportProductNames.PSObject.Properties | Where-Object { $_.Name -notlike '_*' } | ForEach-Object { $_.Value.baselineName } } # Returns the display name for a given baseline name from the configuration schema. static [string] GetDisplayNameFromBaselineName([string]$BaselineName) { [ScubaConfig]::InitializeValidator() # Iterate through the report product names to find the matching baseline name foreach ($property in [ScubaConfig]::_ConfigSchema.schemaMetadata.reportProductNames.PSObject.Properties) { if ($property.Name -notlike '_*' -and $property.Value.baselineName -eq $BaselineName) { return $property.Value.displayName } } # Throw an error if no matching baseline name is found. throw "Unknown baseline name: '$BaselineName'" } # Returns a hashtable of deprecated product aliases from the configuration schema. static [hashtable] GetDeprecatedProductAliases() { [ScubaConfig]::InitializeValidator() $aliases = @{} # Iterate through the deprecated product aliases and populate the hashtable foreach ($property in [ScubaConfig]::_ConfigSchema.schemaMetadata.deprecatedProductAliases.PSObject.Properties) { if ($property.Name -notlike '_*') { $aliases[$property.Name] = $property.Value } } # Return the populated hashtable of deprecated product aliases. return $aliases } # Returns the tenant detail provider for the given product names based on priority. static [string] GetTenantDetailProvider([string[]]$ProductNames) { [ScubaConfig]::InitializeValidator() # Find the first matching product name based on tenant detail priority. $match = [ScubaConfig]::_ConfigSchema.schemaMetadata.reportProductNames.PSObject.Properties | Where-Object { $_.Name -notlike '_*' -and $ProductNames -contains $_.Name } | Sort-Object { $_.Value.tenantDetailPriority } | Select-Object -First 1 # Return 'unknown' if no match is found, otherwise return the tenant detail provider. if ($null -eq $match) { return 'unknown' } return $match.Value.tenantDetailProvider } # Returns configuration information for specified product (baseline file, capabilities, etc.). static [object] GetProductInfo([string]$ProductName) { [ScubaConfig]::InitializeValidator() # Products are not stored in defaults anymore, return a simple object with the product name # This maintains backward compatibility for code that expects this method to work return @{ name = $ProductName } } # Returns array of privileged administrative roles for security validation. static [array] GetPrivilegedRoles() { [ScubaConfig]::InitializeValidator() return [ScubaConfig]::_ConfigDefaults.privilegedRoles } } # SIG # Begin signature block # MIIu9gYJKoZIhvcNAQcCoIIu5zCCLuMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDryLcn6l6NAcqW # tx7hYF0hClDypdRNafQzlHDblQPsCKCCE6MwggWQMIIDeKADAgECAhAFmxtXno4h # MuI5B72nd3VcMA0GCSqGSIb3DQEBDAUAMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQK # EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNV # BAMTGERpZ2lDZXJ0IFRydXN0ZWQgUm9vdCBHNDAeFw0xMzA4MDExMjAwMDBaFw0z # ODAxMTUxMjAwMDBaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJ # bmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lDZXJ0 # IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB # AL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3EMB/z # G6Q4FutWxpdtHauyefLKEdLkX9YFPFIPUh/GnhWlfr6fqVcWWVVyr2iTcMKyunWZ # anMylNEQRBAu34LzB4TmdDttceItDBvuINXJIB1jKS3O7F5OyJP4IWGbNOsFxl7s # Wxq868nPzaw0QF+xembud8hIqGZXV59UWI4MK7dPpzDZVu7Ke13jrclPXuU15zHL # 2pNe3I6PgNq2kZhAkHnDeMe2scS1ahg4AxCN2NQ3pC4FfYj1gj4QkXCrVYJBMtfb # BHMqbpEBfCFM1LyuGwN1XXhm2ToxRJozQL8I11pJpMLm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