Skip to content

Unexpected behavior of href-sanitizer #3650

@zk2f

Description

@zk2f

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

Sometimes the text content of the element does not contain the scheme (http://) and when the scriplet is applied, it incorrectly replaces the href to the (non-existent) page at the current site itself.

Typically the tracking is applied to external URLs only, so the internal link is almost always the wrong one.

A specific URL where the issue occurs.

https://addons.mozilla.org/en-US/firefox/addon/foxy-gestures/

Steps to Reproduce

  1. Visit any page of a site with href-sanitizer applied that also has a link without the scheme in the text content of <a> (for example the above specified URL)
  2. Observe that the modified href is not the correct link.

Expected behavior

On the webpage
https://site1.com/pages/page1
the link
<a href="https://trackersite.com/tracking-id">www.site2.com</a>
should be replaced by
<a href="https://www.site2.com/">www.site2.com<a>

Actual behavior

On the webpage
https://site1.com/pages/page1
the link
<a href="https://trackersite.com/tracking-id">www.site2.com</a>
is replaced by
<a href="https://site1.com/pages/www.site2.com">www.site2.com</a>

uBO version

1.64.1b1

Browser name and version

Mozilla Firefox 139.0.1

Operating System and version

Linux 6.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions