uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
947 stars 81 forks source link

eBay Sponsored links. Shadow DOM #2297

Closed JSCFORCE closed 1 week ago

JSCFORCE commented 2 years ago

Prerequisites

I tried to reproduce the issue when...

Description

eBay uses the shadow DOM to mark certain listings as SPONSORED.

we can't remove them since we can't target the shadow DOM.

Since sites don't get much bigger than this is is time to add support for a :shadow-root(...) operator?

A specific URL where the issue occurs.

https://www.ebay.com/sch/i.html?_from=R40&_nkw=houses&_sacat=0

Steps to Reproduce

Any attempt to target or distinguish the sponsored listings from the normal ones fail.

Expected behavior

Normally removing an ad would be a snap but not when the CSS is hidden from us.

Actual behavior

Can't remove the sponsored ads with uBlock origin in its current form.

uBO version

1.44.4

Browser name and version

Vivaldi 5.4.2753.51

Operating System and version

Windows 10.0.19044.2006

krystian3w commented 1 year ago

But how long?

JSCFORCE commented 1 year ago

doesn't work here: https://www.ebay.com/sch/i.html?_from=R40&_nkw=ti-85&_sacat=0&rt=nc&LH_ItemCondition=3

sigh, what a mess.

stephenhawk8054 commented 1 year ago

doesn't work here: https://www.ebay.com/sch/i.html?_from=R40&_nkw=ti-85&_sacat=0&rt=nc&LH_ItemCondition=3

sigh, what a mess.

It's because of the &LH_ItemCondition=3 at the end.

Test

www.ebay.com##li.s-item a.s-item__link[href]:matches-attr(href="/%3A\w{12}(&.+)?$/"):upward(li.s-item)

This takes care most of the sponsored products except few products at the top in some searches for me.


@gwarser idea works for me too

www.ebay.com##li.s-item .s-item__detail--primary span[role="text"] > span:matches-css(width: /59\.[5-9]/):upward(li.s-item):remove()

But at this point, it just depends on each person's DOM.

MasterKia commented 1 year ago

Can this help? https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/dom/openOrClosedShadowRoot

krystian3w commented 1 year ago

I think nope:

Browser name and version

Vivaldi 5.4.2753.51

I don't know nothing as Vivalidi added support directly installing Moz://a XPI.

rileyvel commented 1 year ago

None of the above still works after eBay's updates. However, window.find can be used to infiltrate closed shadow DOMs - see https://book.hacktricks.xyz/pentesting-web/xss-cross-site-scripting/shadow-dom

I created a proof-of-concept that can be used as a userscript to remove eBay sponsored search results: https://gist.github.com/rileyvel/7162ed1049420e68c0913e52d220366b Works on Chromium and Firefox, but not Safari.

Maybe ublock origin can use this to enforce :has-text filters globally? Otherwise, filter lists can be asked to provide selectors of elements expected to host closed shadow roots (in eBay's case, span.s-item__sep > div). chrome.dom.openOrClosedShadowRoot can then be used to create "portals" between the light DOM and shadow DOM, and cosmetic filters can pass right through.

JSCFORCE commented 1 year ago

Amazing! Thank you for your detective work and making the script. I can confirm it does indeed work.

I would like to subscribe to your newsletter sir!

:)

gorhill commented 7 months ago

Please evaluate whether issue can be closed with https://github.com/gorhill/uBlock/commit/52b46eb98bedfa746206e89ac016734cbbed092a.

krystian3w commented 7 months ago

They can do the creating shadow DOM-s/roots (as childs) in a loop to avoid single exposure.