Skip to content

chore: Dev to release - #184

Merged
Zacgoose merged 15 commits into
mainfrom
dev
Nov 24, 2026
Merged

Zacgoose merged 15 commits into
mainfrom
dev

Conversation

@Zacgoose

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to domain squatting protection and configuration flexibility, especially around how protected domains are defined and managed. It also enhances documentation and deployment scripts for better clarity and reliability, and adds support for new webhook event types.

Domain squatting protection and configuration:

  • The protectedDomains setting for domain squatting detection is now clarified and improved: when set, only those domains are protected, and domains from the URL allowlist are not protected unless protectedDomains is empty. This is reflected in both the schema (config/managed_schema.json) and deployment scripts. [1] [2] [3] [4]
  • Documentation is updated to explain the new behavior: protected domains are now explicitly set, and allowlisting a site only protects it if protectedDomains is unset. Examples and warnings are added to help admins avoid misconfiguration. [1] [2] [3]

Deployment and configuration script enhancements:

  • PowerShell deployment scripts (Deploy-Windows-Chrome-and-Edge.ps1, Detect-Windows-Chrome-and-Edge.ps1, Setup-Windows-Chrome-and-Edge.ps1) are updated to support the new protectedDomains setting, ensuring registry keys are correctly created, removed, and validated. [1] [2] [3]
  • Added support for configuring the valid page badge timeout via policy and scripts, with default and range validation. [1] [2] [3] [4]

Webhook and event enhancements:

  • Added a new domain_squatting_detected event type for webhooks, allowing external systems to be notified when a domain squatting attempt is detected. [1] [2] [3]

Rules update reliability and documentation:

  • Improved rules update logic and documentation: if a rules update fails, the extension continues using the last successfully downloaded rules and only falls back to bundled rules if none have ever been downloaded. This ensures continued protection during outages or network problems. [1] [2] [3]

These changes collectively provide more precise control over domain squatting protection, improve deployment reliability, and clarify configuration for both administrators and end users.

Kevin Phillips and others added 12 commits October 16, 2026 16:33
browser-polyfill.js calls chrome.storage.* with a callback, but the mock
only returned a promise, so every storage read in a test hung and the
existing suite was cancelled before any test ran. Accept an optional
callback on storage get/set/remove/clear, return a promise from
runtime.sendMessage like the real API, and record sent messages so
tests can assert on broadcasts.
When a rules update failed (GitHub outage, rate limiting, network
problems), the extension fell back to the bundled rules, which can be
several releases behind and cause false alerts. This happened in two
ways: an expired cache was discarded on startup (frequent with MV3
service worker restarts), and a failed background refresh replaced the
in-memory rules with the bundled ones.

The persisted cache only ever holds rules from a successful remote
fetch, so treat it as the last-known-good copy:

- Load cached rules regardless of age; age still triggers a refresh.
- On a failed fetch, keep the last downloaded rules (from memory or
  storage). Bundled rules are used only if nothing was downloaded.
- Reject responses that are not a rules file so they can't replace
  good rules.
- Wait at least 5 minutes between attempts after a failure, so an
  outage or rate limit doesn't trigger a request on every page load.
- Make forceUpdate() report a failed download instead of success.

Closes #176
- Store the time of the last failed fetch so the retry delay survives
  service worker restarts. Previously a restarted worker refetched on
  startup even during an outage.
- Have each fetch report its outcome to its caller instead of through
  a shared field, so an overlapping fetch can't make "Update Rules Now"
  report the wrong result.
Implement fallback mechanism for cached rules fetching

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Kevin Phillips <k.phillips.jr1101@gmail.com>
…rules

fix(rules): keep last downloaded detection rules when an update fails
…tectedDomains

- match combosquats on whole hyphen-separated words, and glued-on text only for names of 5+ letters
- skip edit-distance and typo checks for names under 5 letters and allow 1 edit up to 8 letters
- protect domainSquatting.protectedDomains when set, falling back to the URL allowlist domains
- reload the squatting detector when managed policy changes
…ng webhook

- add protectedDomains and validPageBadgeTimeout to the Windows deploy, detect and setup scripts, the ADMX and the macOS/Firefox templates
- allow domain_squatting_detected in the managed webhook events
- never flag an allowlisted host or its subdomains as squatting
- drop double quotes from ADML webhook help text

Fixes #155
Fixes #156
Fixes #163
- add an Update Rules Now button to the enterprise managed notice
- hide Clear Logs while the extension is policy managed

Fixes #158
Fixes #180
…nd's own glued names

- parse https://*.example.com/* allowlist entries as example.com
- glued combinations (googleusercontent) only count when the added text starts or ends with a suspicious word
- the payload now carries the user block and the documented url/reason fields

Fixes #177
@Zacgoose
Zacgoose requested review from a team and a balanced review from Copilot November 24, 2026 11:03
@Zacgoose Zacgoose changed the title Dev to release chore: Dev to release Nov 24, 2026

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.

🟡 Changes recommended

A critical allowlist-scope regression exempts an entire host and its subdomains from squatting detection when only one URL is allowlisted.

3 open issues
What changed in this PR

This release update improves domain-squatting configuration and rules-update resilience in the Check phishing-protection extension, with supporting enterprise deployment and interface changes.

Changes:

  • Adds explicit protected-domain settings and refines lookalike detection to reduce false positives.
  • Retains downloaded rules during update failures, adds retry backoff, and expands regression coverage.
  • Updates enterprise policies, managed-mode controls, webhook reporting, and documentation.
File Description
tests/​helpers/​chrome-mock.js Supports callback APIs and records runtime messages.
tests/​domain-squatting-detector.test.js Adds protection-scope and lookalike detection tests.
tests/​detection-rules-manager.test.js Tests cache retention, retries, and overlapping updates.
scripts/​modules/​domain-squatting-detector.js Adds explicit targets and refines detection heuristics.
scripts/​modules/​detection-rules-manager.js Validates downloads, retains cached rules, and manages retries.
scripts/​blocked.js Routes false-positive reports through the background handler.
scripts/​background.js Reinitializes domain protection after policy changes.
rules/​detection-rules.json Replaces URL-pattern lookbehind with an anchored expression.
options/​options.js Adds managed-mode rule updates and hides log clearing.
options/​options.css Positions the managed-mode update button.
enterprise/​Setup-Windows-Chrome-and-Edge.ps1 Adds protected-domain and badge-timeout prompts.
enterprise/​macos-linux/​edge-managed-policy.json Adds an Edge protected-domain setting.
enterprise/​macos-linux/​chrome-managed-policy.json Adds a Chrome protected-domain setting.
enterprise/​macos-linux/​check-extension-config.mobileconfig Adds protected domains to the configuration profile.
enterprise/​firefox/​policies.json Adds a Firefox protected-domain setting.
enterprise/​Detect-Windows-Chrome-and-Edge.ps1 Checks protected-domain registry values and badge timeout.
enterprise/​Deploy-Windows-Chrome-and-Edge.ps1 Writes protected domains and badge timeout to policy.
enterprise/​admx/​en-US/​Check-Extension.adml Adds policy labels, explanations, and webhook event text.
enterprise/​admx/​Check-Extension.admx Defines protected-domain policies for Chrome and Edge.
docs/​settings/​detection-rules.md Explains continued protection after update failures.
docs/​features/​domain-squatting-detection.md Documents target selection and short-name behavior.
docs/​advanced/​creating-detection-rules.md Documents download validation, cache retention, and retries.
config/​managed_schema.json Clarifies protected domains and permits squatting webhook events.

Review effort: Balanced

Added input validation for valid page badge timeout setting.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>

@rvdwegen rvdwegen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wooooooooooooooooo

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.

🟡 Changes recommended

Insufficient rules validation can replace the last working cache with malformed data that breaks phishing detection, while blocked-page messaging falsely reports failures on supported Chrome 88–98.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Use callback-based messaging for Chrome 88–98

scripts/​blocked.js:156

blocked.html loads this script without the browser polyfill, but the Promise form of native chrome.runtime.sendMessage requires Chrome 99+. On supported Chrome 88–98, awaiting this call yields undefined, so the UI reports failure even when delivery succeeds. Wrap the callback form in a Promise and reject on chrome.runtime.lastError.

3 resolved since last review

Review effort: Balanced

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.

🔵 Needs a closer look

Webhook delivery failures show a generic message instead of the nested error and HTTP status, losing diagnostic details needed to troubleshoot failed reports.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Read nested delivery errors to show webhook failure details

scripts/​blocked.js:188

HTTP and network delivery errors are returned under response.result.results[*].error, so this branch shows “Report could not be sent” instead of the actual failure. This loses the HTTP status previously displayed and makes webhook failures harder to diagnose. Read the nested delivery error and response.result.error before falling back to the generic message, while preserving top-level error handling.

1 resolved since last review

Review effort: Balanced

@Zacgoose
Zacgoose merged commit a73495c into main Nov 24, 2026
10 checks 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.

4 participants