Skip to content

Use Spoofchecker::isSuspicious in phishing link host analysis#13090

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/nextcloud-mail-13089-check-spoofchecker
Draft

Use Spoofchecker::isSuspicious in phishing link host analysis#13090
Copilot wants to merge 2 commits into
mainfrom
copilot/nextcloud-mail-13089-check-spoofchecker

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Current phishing link detection only flagged host mismatches between anchor text and href, which misses homograph/suspicious-host cases when both sides match. This change adds suspicious-host detection using ICU Spoofchecker as an additional signal, with safe fallback when unavailable.

  • Detection logic update (LinkCheck)

    • Extract parsed hosts for normalized href and displayed link text.
    • Mark link as phishing when:
      • hosts differ (existing behavior), or
      • either host is flagged by Spoofchecker::isSuspicious.
    • Introduce isSuspiciousHost(?string $host): bool to encapsulate spoof checking and tolerate missing extension/runtime errors.
  • User-facing phishing message

    • Update warning text from mismatch-only phrasing to include suspicious-host cases.
  • Targeted unit coverage

    • Add a focused test case for “matching host but suspicious” to verify the new branch.
$hrefHost = parse_url($this->parse($url), PHP_URL_HOST);
$linkTextHost = parse_url($this->parse($zipped['linkText']), PHP_URL_HOST);

if ($hrefHost !== $linkTextHost
	|| $this->isSuspiciousHost($hrefHost)
	|| $this->isSuspiciousHost($linkTextHost)) {
	$results[] = [
		'href' => $url,
		'linkText' => $zipped['linkText'],
	];
}

Copilot AI changed the title [WIP] Check if Spoofchecker::isSuspicious should be used for phishing detection Use Spoofchecker::isSuspicious in phishing link host analysis Jun 16, 2026
Copilot AI requested a review from kesselb June 16, 2026 15:48
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