Skip to content

fix(enterprise): correct domainSquattingEnabled replacement pattern - #175

Merged
Zacgoose merged 1 commit into
CyberDrain:devfrom
bmsimp:fix/setup-domain-squatting-pattern
Aug 12, 2026
Merged

fix(enterprise): correct domainSquattingEnabled replacement pattern#175
Zacgoose merged 1 commit into
CyberDrain:devfrom
bmsimp:fix/setup-domain-squatting-pattern

Conversation

@bmsimp

@bmsimp bmsimp commented Aug 12, 2026

Copy link
Copy Markdown
Member

Problem

Setup-Windows-Chrome-and-Edge.ps1 fails for every user with:

Failed to customize the Deploy template; the following expected pattern(s) were not found:
  - $domainSquattingEnabled = 1 #
The upstream template format may have changed.

The replacement map searched for $domainSquattingEnabled = 1 #, but both templates ship the setting as = 0 #:

  • Deploy-Windows-Chrome-and-Edge.ps1:25
  • Detect-Windows-Chrome-and-Edge.ps1:34

Apply-Replacements matches with String.Contains, so the lookup missed, the pattern was added to $missing, and the script threw before writing any output files. Nothing was produced for Intune.

This was unrelated to the answers given at the prompts. The script's own prompt default for this setting is already "0", so only the pattern literal was wrong.

Fix

One line: the pattern now reads $domainSquattingEnabled = 0 #, matching the templates.

Verification

  • Downloaded the current Deploy, Detect, and Remove templates from refs/heads/main and checked all 23 replacement patterns against them. This was the only mismatch.
  • Ran the real replacement block from the edited script end to end against both templates: every replacement applies, and both generated scripts parse cleanly via Parser::ParseInput.
  • Confirmed single-quote escaping still holds for user input (O'Brien IT renders as 'O''Brien IT').

Note for maintainers

Each pattern hardcodes the template's current default value, so any future change to a default will break setup with this same exception. Anchoring on $varName = through to # would make the matching value-agnostic. Happy to follow up with that if you want it.

🤖 Generated with Claude Code

The setup script searched the downloaded templates for
`$domainSquattingEnabled = 1 #`, but both Deploy and Detect ship the
setting as `= 0 #`. Apply-Replacements matches with String.Contains,
so the lookup missed, the pattern landed in $missing, and the script
threw "Failed to customize the Deploy template" before writing any
output files.

This failed for every user regardless of the answers given at the
prompts, and it was the only pattern of the 23 that did not match.

Verified all 23 patterns against the current Deploy and Detect
templates on main, then ran the replacement block end to end: every
replacement applies and both generated scripts parse as valid
PowerShell.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 12, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes enterprise setup script generation by aligning the domainSquattingEnabled replacement pattern with the actual defaults in the Deploy/Detect PowerShell templates, preventing Setup-Windows-Chrome-and-Edge.ps1 from throwing and failing to produce Intune-ready output.

Changes:

  • Update the domainSquattingEnabled replacement pattern from = 1 # to = 0 # to match shipped templates.
  • Restore successful template customization by ensuring Apply-Replacements finds all expected patterns.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 229 to 233
@{ Pattern = '$updateInterval = 24 #'; Value = "`$updateInterval = $cfg_updateInterval #" }
@{ Pattern = '$domainSquattingEnabled = 1 #'; Value = "`$domainSquattingEnabled = $cfg_domainSquattingEnabled #" }
@{ Pattern = '$domainSquattingEnabled = 0 #'; Value = "`$domainSquattingEnabled = $cfg_domainSquattingEnabled #" }
@{ Pattern = '$enableDebugLogging = 0 #'; Value = "`$enableDebugLogging = $cfg_enableDebugLogging #" }
@{ Pattern = '$enableGenericWebhook = 0 #'; Value = "`$enableGenericWebhook = $cfg_enableGenericWebhook #" }
@{ Pattern = '$webhookUrl = "" #'; Value = "`$webhookUrl = $(Format-SingleQuoted $cfg_webhookUrl) #" }
@Zacgoose
Zacgoose merged commit 4976df5 into CyberDrain:dev Aug 12, 2026
7 checks passed
@bmsimp
bmsimp deleted the fix/setup-domain-squatting-pattern branch August 12, 2026 13:38
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.

3 participants