Skip to content

Conversation

Copy link

Copilot AI commented Jan 6, 2026

PowerShell-deployed enterprise policies (CIPP Server, generic webhook) were not applied because scripts directly accessed chrome.storage.local.get(["config"]) instead of using ConfigManager, bypassing the enterprise policy merging logic.

Root Cause

Scripts throughout the extension were reading configuration directly from local storage:

// Before: Only reads local config, misses enterprise policies
const result = await storage.local.get(["config"]);
const config = result?.config || {};

// After: Gets merged enterprise + local config
const config = await configManager.getConfig();

ConfigManager already had the correct logic to merge enterprise policies (from storage.managed set by PowerShell/GPO) with local configuration, but many scripts bypassed it by reading storage directly.

Changes

  • DetectionRulesManager: Now accepts ConfigManager instance and uses configManager.getConfig() instead of direct storage access
  • Background Script: Passes ConfigManager instance to DetectionRulesManager
  • Content Script: Updated all config/branding access to use GET_CONFIG and GET_BRANDING_CONFIG messages with fallback to local storage only when background unavailable:
    • loadDeveloperConsoleLoggingSetting()
    • showWarningBanner()
    • showValidBadge()
    • sendCippReport()
    • applyBrandingColors()

Why This Works

ConfigManager merges enterprise policies from storage.managed (PowerShell registry entries) with local config. By ensuring all scripts use ConfigManager instead of direct storage access, enterprise policies are now properly applied throughout the extension.

Example

PowerShell deployment now works correctly:

$enableGenericWebhook = 1
$webhookUrl = "https://webhook.example.com"
$webhookEvents = @("detection_alert", "page_blocked")

ConfigManager merges these enterprise settings with local defaults, and all scripts receive the merged configuration. Webhooks fire as expected.

Original prompt

Issue Description

When I deploy via PowerShell and specify the CIPP Server or the generic webhook, it does not work. The malicious sites are still blocked, but it doesn't send the report or webhook.
If I manually install and set the same CIPP server and webhook, both works as expected.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits January 6, 2026 12:54
…l deployment

- Add deepMerge utility function to handle nested object merging
- Update mergeConfigurations to use deep merge instead of shallow spread
- Add genericWebhook default configuration structure
- Add comprehensive tests for deep merge behavior

Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
- Handle null/undefined sources gracefully
- Handle non-object targets properly
- Use direct assignment instead of Object.assign for better performance
- Update test page documentation to clarify usage
- Prevent infinite recursion in edge cases

Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
- Add hasOwnProperty check to only process own properties
- Block dangerous keys (__proto__, constructor, prototype)
- Prevent prototype chain pollution attacks
- Maintain normal nested object functionality

Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix PowerShell deployment issue for CIPP Server and webhook Fix PowerShell deployment webhook configuration via deep merge Jan 6, 2026
Copilot AI requested a review from Zacgoose January 6, 2026 13:04
@Zacgoose
Copy link
Owner

Zacgoose commented Jan 7, 2026

@copilot that was not the issue, plase remove all your chnages, what I actually think is the issue is direct use of chrome.storage.local.get rather than the scripts calling the config manager to get the config since its a central place to manage and merge the configs it should be used instead of direct chrome.storage.local.get and simular calls

- Revert previous deep merge changes
- Pass ConfigManager to DetectionRulesManager constructor
- Update DetectionRulesManager to use ConfigManager.getConfig() instead of direct storage access
- Update content.js to use GET_CONFIG and GET_BRANDING_CONFIG messages instead of direct storage
- Ensures enterprise policies are properly merged with local config in all contexts

Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 7, 2026

@copilot that was not the issue, plase remove all your chnages, what I actually think is the issue is direct use of chrome.storage.local.get rather than the scripts calling the config manager to get t...

You're absolutely right! I've reverted all my previous changes and implemented the correct fix.

The actual issue was that scripts were directly calling chrome.storage.local.get(["config"]) instead of using ConfigManager, which bypassed the enterprise policy merging logic.

Fixed in commit ffbfa94:

  1. DetectionRulesManager now accepts and uses ConfigManager to get merged enterprise + local config
  2. Content script now uses GET_CONFIG and GET_BRANDING_CONFIG messages to request merged configuration from the background script
  3. All direct storage access has been replaced with proper ConfigManager usage (with fallback to local storage only when background is unavailable)

This ensures PowerShell-deployed enterprise policies are properly merged with local config throughout the extension.

Copilot AI changed the title Fix PowerShell deployment webhook configuration via deep merge Fix PowerShell deployment webhook configuration by using ConfigManager Jan 7, 2026
@Zacgoose
Copy link
Owner

Zacgoose commented Jan 7, 2026

@copilot Perfect that looks like it would fix our cippreporting issue where that was not triggering

@Zacgoose Zacgoose changed the base branch from dev to storage-loading-fix January 8, 2026 00:23
@Zacgoose Zacgoose marked this pull request as ready for review January 8, 2026 00:23
@Zacgoose Zacgoose merged commit 7ba299a into storage-loading-fix Jan 8, 2026
1 check passed
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