Skip to content

Case-sensitive domain matching allows blocklist bypass #2190

Closed

Description

@asmit25805

Was reading browse/src/content-security.ts and noticed a potential security gap.

The issue

The blocklist checks use case‑sensitive string inclusion, e.g., if (url.includes(domain)) { and if (contentUrl.includes(domain)) {, which can be bypassed by using uppercase letters in the domain part of a URL.

Where

urlBlocklistFilter in browse/src/content-security.ts

Suggested fix

Perform case‑insensitive matching on the hostname, for example:

import { URL } from 'url';

function domainMatches(urlStr: string, domain: string): boolean {
  try {
    const hostname = new URL(urlStr).hostname.toLowerCase();
    return hostname.includes(domain.toLowerCase());
  } catch {
    return false;
  }
}
// In urlBlocklistFilter replace the checks with:
if (domainMatches(url, domain)) { ... }
if (domainMatches(contentUrl, domain)) { ... }

Happy to open a PR if that would be useful.

I've tried to follow your contribution guidelines — let me know if I've missed anything.

Activity

  1. added a commit that references this issue on Jul 14, 2026
  2. added a commit that references this issue on Jul 14, 2026
    279fda4
  3. added 2 commits that reference this issue on Jul 15, 2026
    2c743db
    3eb22b8
  4. added a commit that references this issue on Jul 18, 2026
    4d62f49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions