Skip to content

Conversation

@NumidiaLive
Copy link

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

  • Code follows project coding standards
  • All tests pass (45/45 tests passing)
  • Documentation is comprehensive and up-to-date
  • Backwards compatibility maintained
  • Error handling is robust and graceful
  • GPO integration is complete
  • MSI installer configuration is updated
  • 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.

Romanitho and others added 5 commits May 26, 2025 14:45
This commit introduces comprehensive dual listing mode support that allows
simultaneous use of both whitelist and blacklist configurations with
blacklist taking precedence over whitelist.

Key Features:
- Dual listing mode with blacklist precedence
- Supports GPO, registry, and file-based configuration
- Wildcard pattern matching support
- Graceful error handling and fallback mechanisms
- Comprehensive logging and audit trail

Core Changes:
- Add Get-DualListApps.ps1 for main dual listing logic
- Add Test-DualListPath.ps1 for external list handling
- Enhance Get-WAUConfig.ps1 with error handling
- Update Get-IncludedApps.ps1 and Get-ExcludedApps.ps1 with robust error handling
- Integrate dual listing mode into Winget-Upgrade.ps1 main flow

Configuration:
- Add WAU_UseDualListing registry value to MSI installer
- Update GPO policy templates with dual listing support
- Support for external list paths in dual listing mode

Testing:
- Comprehensive unit tests (45 tests, 100% pass rate)
- Integration tests for all configuration methods
- Real-world scenario testing scripts
- Performance tests for large application lists

Documentation:
- Complete feature documentation in DUAL_LISTING_MODE.md
- Implementation summary and API reference
- Test suite documentation and examples

This implementation follows enterprise-grade practices with:
- Robust error handling and graceful degradation
- Comprehensive logging for troubleshooting
- PowerShell best practices compliance
- Backwards compatibility with existing configurations

Resolves requirements for dual listing functionality while maintaining
security-first approach with blacklist precedence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants