Skip to content

trusted-replace-fetch-response does not work when fetch() is called with new URL() #3892

@mary-ext

Description

@mary-ext

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is NOT a YouTube, Facebook or Twitch report. These sites MUST be reported by clicking their respective links.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

trusted-replace-fetch-response starts matching on all fetch requests done like so

const response = await fetch(new URL(`https://selfhosted.social/xrpc/com.atproto.server.describeServer`));
const json = await response.json();

even though the filter is matching for something else, for example, this filter which spoofs geolocation requests that Bluesky attempts

bsky.app,main.bsky.dev##+js(trusted-replace-fetch-response, '/.*/', '{"countryCode":"US","regionCode":"WA"}', 'ip.bsky.app/geolocation')

A specific URL where the issue occurs.

https://bsky.app/

Steps to Reproduce

  1. Add the trusted-replace-fetch-response filter rule example provided above
  2. Enable "Allow custom filters requiring trust"
  3. Go to https://bsky.app
  4. Attempt to login

Expected behavior

It should not complain about "Bluesky Social" (or any other hosting provider/PDS you have set) being unreachable

Actual behavior

You'd get a banner saying "Unable to contact your service. Please check your Internet connection."

Thankfully Bluesky seems to have public source maps, so if we set a breakpoint on src/screens/Login/index.tsx for the serviceError check located here:

https://github.com/bluesky-social/social-app/blob/2d8e855e25e8722ee37c90a5413acd7a36d43318/src/screens/Login/index.tsx#L89-L95

You'd get this result on serviceError

Image

This error happens because of this validation code

https://github.com/bluesky-social/atproto/blob/104e6ed37b0589cc000109dc76316be35b2257e1/packages/xrpc/src/xrpc-client.ts#L111-L114

uBO version

1.68.0

Browser name and version

Firefox 145.0.2 (archlinux package)

Operating System and version

Linux (Arch Linux, Linux lily 6.18.0-5-cachyos #1 SMP PREEMPT_DYNAMIC Sun, 07 Dec 2025 12:44:05 +0000 x86_64 GNU/Linux)

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