Winget-AutoUpdate icon indicating copy to clipboard operation
Winget-AutoUpdate copied to clipboard

Release: Add dual listing mode functionality

Open NumidiaLive opened this issue 5 months ago • 0 comments

Pull Request: Add Dual Listing Mode Functionality

📋 Summary

This PR introduces comprehensive dual listing mode functionality to Winget-AutoUpdate, allowing simultaneous use of both whitelist and blacklist configurations with blacklist taking precedence over whitelist.

🚀 Key Features

Core Functionality

  • Dual Listing Mode: Use both whitelist and blacklist simultaneously
  • Blacklist Precedence: Blacklist always overrides whitelist (security-first approach)
  • Flexible Configuration: Support for GPO, registry, and file-based configuration
  • Wildcard Support: PowerShell wildcard patterns in both lists
  • Graceful Error Handling: Robust error handling with fallback mechanisms
  • Comprehensive Logging: Detailed logging for troubleshooting and auditing

Enterprise Ready

  • Group Policy Integration: Full GPO support with policy precedence
  • MSI Installer Support: Automatic configuration during installation
  • External List Support: URI-based and file-based external lists
  • Backwards Compatibility: Maintains compatibility with existing configurations

🔧 Technical Implementation

Files Added

  • Sources/Winget-AutoUpdate/functions/Get-DualListApps.ps1 - Core dual listing logic
  • Sources/Winget-AutoUpdate/functions/Test-DualListPath.ps1 - External list handling
  • DUAL_LISTING_MODE.md - Comprehensive feature documentation
  • Tests/ - Complete test suite (45 tests, 100% pass rate)

Files Modified

  • Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 - Main integration
  • Sources/Winget-AutoUpdate/functions/Get-WAUConfig.ps1 - Enhanced error handling
  • Sources/Winget-AutoUpdate/functions/Get-IncludedApps.ps1 - Robust error handling
  • Sources/Winget-AutoUpdate/functions/Get-ExcludedApps.ps1 - Robust error handling
  • Sources/Wix/build.wxs - MSI installer configuration
  • Sources/Policies/ADMX/WAU.admx - GPO policy template
  • Sources/Policies/ADMX/en-US/WAU.adml - GPO localization

📊 Test Coverage

Unit Tests

  • 45 tests covering all dual listing scenarios
  • 100% pass rate with comprehensive edge case coverage
  • Performance tests for large application lists
  • Error handling tests for robustness validation

Integration Tests

  • GPO Configuration: End-to-end GPO integration testing
  • Registry Configuration: Direct registry configuration testing
  • File Configuration: File-based configuration testing
  • Real-world Scenarios: Actual winget installation testing

Test Scripts

  • Tests/DualListingMode.Tests.ps1 - Unit tests
  • Tests/DualListingMode.Integration.Tests.ps1 - Integration tests
  • Tests/Test-DualListingQuick.ps1 - Quick demonstration script
  • Tests/Test-DualListingRealWorld.ps1 - Real-world scenario testing

🎯 Usage Examples

Basic GPO Configuration

# Enable dual listing mode
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate" -Name "WAU_UseDualListing" -Value 1

# Add applications to whitelist
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList" -Name "1" -Value "Microsoft.Teams"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\WhiteList" -Name "2" -Value "Adobe.Acrobat.Reader.64-bit"

# Add application to blacklist (overrides whitelist)
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Romanitho\Winget-AutoUpdate\BlackList" -Name "1" -Value "Microsoft.Teams"

Decision Logic

  1. Check Version: Skip apps with "Unknown" version
  2. Check Blacklist: If app is in blacklist → SKIP (blacklist wins)
  3. Check Whitelist: If whitelist exists and app is in whitelist → UPDATE
  4. No Whitelist: If no whitelist configured → UPDATE (not in blacklist)

🔍 Testing Instructions

Quick Test

# Run demonstration script
.\Tests\Test-DualListingQuick.ps1

# Show current configuration
.\Tests\Test-DualListingQuick.ps1 -ShowConfiguration

Full Test Suite

# Run all tests
.\Tests\Run-DualListingTests.ps1

# Run specific test type
.\Tests\Run-DualListingTests.ps1 -TestType Unit

Real-world Test

# Test with actual applications
.\Tests\Test-DualListingRealWorld.ps1

📖 Documentation

  • DUAL_LISTING_MODE.md: Complete feature documentation
  • Tests/README-DualListingMode.md: Test suite documentation
  • Tests/IMPLEMENTATION-SUMMARY.md: Implementation details

🔒 Security Considerations

  • Blacklist Precedence: Security restrictions always override permissions
  • Input Validation: Comprehensive validation of configuration inputs
  • Error Handling: Secure error handling with no sensitive data exposure
  • Audit Logging: Complete audit trail of all decisions

🎪 Backwards Compatibility

  • Existing Configurations: All existing whitelist/blacklist configurations continue to work
  • Default Behavior: When dual listing is disabled, behavior is unchanged
  • Graceful Degradation: Fallback to standard behavior on configuration errors

🔍 Breaking Changes

None - This is a fully backwards-compatible addition.

📋 Checklist

  • [x] Code follows project coding standards
  • [x] All tests pass (45/45 tests passing)
  • [x] Documentation is comprehensive and up-to-date
  • [x] Backwards compatibility maintained
  • [x] Error handling is robust and graceful
  • [x] GPO integration is complete
  • [x] MSI installer configuration is updated
  • [x] Real-world testing scenarios validated

🎯 Related Issues

This PR addresses the requirement for dual listing functionality that enables:

  • Simultaneous use of whitelist and blacklist configurations
  • Blacklist precedence over whitelist for security
  • Enterprise-grade configuration management
  • Comprehensive testing and validation

📞 Support

For questions or support regarding this feature:

  • Review the comprehensive documentation in DUAL_LISTING_MODE.md
  • Check the test suite examples in Tests/
  • Test with the provided demonstration scripts

Ready for review

This implementation provides enterprise-grade dual listing functionality with comprehensive testing, documentation, and backwards compatibility.

NumidiaLive avatar Jul 16 '25 13:07 NumidiaLive