Substring URL match in broadcastPatreonStatus can target non-YouTube tabs

Author: chirag127Created Jul 4, 2026Updated Jul 4, 2026

Problem

tab.url.includes("youtube.com") uses substring matching instead of hostname parsing, so tabs whose URL merely contains youtube.com anywhere (path/query/fragment/hostname suffix) are included in the Patreon-status broadcast loop.

Read cite

Extensions/combined/ryd.background.js:21

javascript
.filter((tab) => tab.url && tab.url.includes("youtube.com"))

Steps

  1. Open a tab with URL https://example.com/?ref=youtube.com.
  2. Trigger Patreon auth (or reload the extension while authenticated).
  3. broadcastPatreonStatus iterates that tab and calls chrome.tabs.sendMessage on it.

Expected

Only tabs whose hostname is youtube.com or *.youtube.com are considered. Use new URL(tab.url).hostname and check === "youtube.com" || endsWith(".youtube.com").

Actual

Any tab whose full URL string contains the literal youtube.com is included. The sendMessage currently fails silently on non-YouTube tabs (no content-script receiver), but the filter is still incorrect and the chrome.runtime.lastError path is exercised for every false-positive tab on each broadcast.

Environment

Repo: Anarios/return-youtube-dislike @ main. Extension package.json version 4.0.4. Node .nvmrc v22.17.0. manifest-chrome.json MV3.

Thanks for maintaining Anarios/return-youtube-dislike!

Source: Anarios/return-youtube-dislike