uBlockOrigin / uAssets

Resources for uBlock Origin, uMatrix: static filter lists, ready-to-use rulesets, etc.
GNU General Public License v3.0
3.61k stars 694 forks source link

open.spotify.com: ads / breakages #22198

Open boromirmonk opened 4 months ago

boromirmonk commented 4 months ago

Prerequisites

URL address of the web page

https://open.spotify.com/

Category

ads

Description

Today, the site starting showing ads while having uBlock Origin activated.

Other extensions used

None.

Screenshot(s)

Screenshot(s)

Configuration

```yaml uBlock Origin: 1.55.0 Chromium: 121 filterset (summary): network: 118987 cosmetic: 51582 scriptlet: 20570 html: 0 listset (total-discarded, last-updated): default: user-filters: 0-0, never easylist: 79742-14, now easyprivacy: 43563-40, now plowe-0: 3783-1173, now spa-0: 3821-19, 16m spa-1: 5790-218, now ublock-badware: 7791-136, now ublock-filters: 36681-225, now ublock-privacy: 992-6, now ublock-quick-fixes: 128-5, now ublock-unbreak: 2192-34, now urlhaus-1: 8675-0, 16m filterset (user): [empty] trustedset: removed: chrome-scheme switchRuleset: added: [array of 2 redacted] userSettings: [none] hiddenSettings: [none] supportStats: allReadyAfter: 424 ms (selfie) maxAssetCacheWait: 202 ms cacheBackend: browser.storage.local popupPanel: blocked: 8 network: doubleclick.net: 3 sentry.io: 5 ```
zaraford commented 4 months ago

same

dportvine commented 4 months ago

It seems to works for me.

||creativeservice-production.scdn.co/mp3-ad/$media,redirect=noop-1s.mp4:10,from=open.spotify.com
Screen ![2024-01-25_194653](https://github.com/uBlockOrigin/uAssets/assets/111344219/ea5ff4b9-6730-4b80-8802-670d0ce5d014) ![2024-01-25_194751](https://github.com/uBlockOrigin/uAssets/assets/111344219/6903ad06-f4e0-4f36-9e50-9ed619b3b56b) ![2024-01-25_200329](https://github.com/uBlockOrigin/uAssets/assets/111344219/e4a80ab6-5595-4de1-8061-9fb85083ce3c)
```yaml uBlock Origin: 1.55.0 Chromium: 121 filterset (summary): network: 130377 cosmetic: 116430 scriptlet: 27288 html: 0 listset (total-discarded, last-updated): removed: urlhaus-1: null plowe-0: null added: https://easylist-downloads.adblockplus.org/bitblock.txt: 26081-19, 22h.22m https://easylist-downloads.adblockplus.org/cntblock.txt: 1698-26, 9h.24m https://www.awwwwesome.org/url-blocklist/url-blocklist.txt: 1656-0, 9h.24m adguard-cookies: 28457-246, 23m ublock-annoyances: 6585-44, 4h.3m Δ default: user-filters: 4-0, never ublock-filters: 36678-107, 4h.3m Δ ublock-badware: 7791-10, 4h.3m Δ ublock-privacy: 992-9, 4h.3m Δ ublock-unbreak: 2192-6, 4h.3m Δ ublock-quick-fixes: 128-6, 4h.3m Δ easylist: 79607-251, 4h.3m Δ easyprivacy: 43562-403, 4h.3m Δ RUS-0: 40155-277, 4h.23m Δ filterset (user): [array of 4 redacted] userSettings: advancedUserEnabled: true contextMenuEnabled: false showIconBadge: false hiddenSettings: cacheStorageAPI: indexedDB filterAuthorMode: true popupPanelHeightMode: 1 trustedListPrefixes: ublock- user- supportStats: allReadyAfter: 942 ms (selfie) maxAssetCacheWait: 568 ms cacheBackend: indexedDB popupPanel: blocked: 10 network: cookielaw.org: 1 doubleclick.net: 4 googleoptimize.com: 1 sentry.io: 4 extended: ##+js(remove-node-text, script, cookieUpdateConsentUrl) ##+js(remove-attr, jsaction, #islsp c-wiz a[href^="http"][data-v… ##+js(set-constant, rwt, noopFunc) ##+js(trusted-set-cookie, SOCS, CAESHAgBEhJnd3NfMjAyMzA2MTItMF9S… ```
stephenhawk8054 commented 4 months ago

We had many issues opened for spotify: https://github.com/uBlockOrigin/uAssets/issues?q=is%3Aissue+open.spotify.com

Maybe we should put a megathread for this site?

dportvine commented 4 months ago

Maybe we should put a megathread for this site?

Also I see a lot of comments on reddit.com, so let's create one megathread.

gettysburg commented 4 months ago

I suggested a different approach to the Spotify Web Client ads taken from the desktop adblock "BlockTheSpot" linked here:

https://github.com/uBlockOrigin/uAssets/issues/22231

Essentially the desktop client is is a browser engine that downloads, executes and renders the same files from the same web-server as the web client runs on.

So, using their method, you can not only disable ad distribution completely, but also enable other features that usually only premium members get access to.

Unfortunately I was not aware of this issues existence.

stephenhawk8054 commented 4 months ago

uBO blocking works by filters. Specific solutions for specific sites that need deeper modifications to the scripts require dedicated scripts for it, which can only be updated when the whole extension updates. It's better to leave those solutions to dedicated extensions.

ItsProfessional commented 4 months ago

but also enable other features that usually only premium members get access to.

FYI: That's out of scope, we don't fix paywalls to features. Only the ads will be blocked.

gettysburg commented 4 months ago

@ItsProfessional That's fine.

@stephenhawk8054 Yeah, but does uBO not have the ability to inject scripts?

If so, could you inject something that changes the default state of a JS boolean or change some site specific code?

Take a look at the issue I posted to see what I mean, they essentially just wait for the browser engine to read a certain file and then patch it up.

stephenhawk8054 commented 4 months ago

@gettysburg Scripts injection works by using a set of pre-defined scriptlets: https://github.com/gorhill/uBlock/wiki/Resources-Library

We don't write arbitrary long scripts for specific sites. As I said, that can only be maintained and updated when the whole extension updates. It cannot be updated frequently like filters whenever the site changes something.

ItsProfessional commented 4 months ago

they essentially just wait for the browser engine to read a certain file and then patch it up.

We want to avoid code manipulation (i.e. patches) to the site's scripts whenever possible, as this is basically RCE.

stephenhawk8054 commented 4 months ago

I see this request

image

I'll update

||2mdn.net^$media,redirect=noop-1s.mp4:10,domain=open.spotify.com
stephenhawk8054 commented 4 months ago

Anyone knows if using *$media,redirect-rule=noop-1s.mp4:10,domain=open.spotify.com caused any issues in the past?

dportvine commented 4 months ago

I see this request

Screen ![image](https://private-user-images.githubusercontent.com/66517106/300237396-ee5a892e-c987-444e-88b7-6f24faba010c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDY0NTc4MjAsIm5iZiI6MTcwNjQ1NzUyMCwicGF0aCI6Ii82NjUxNzEwNi8zMDAyMzczOTYtZWU1YTg5MmUtYzk4Ny00NDRlLTg4YjctNmYyNGZhYmEwMTBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTI4VDE1NTg0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ4MjVlNGYwZWZmMThjOTI2NWU2ZDQzZjRiMGNjZjE3Y2NiZjdlMzQwOWIwMDcyNjQxZjMxZDg5MDlkNDg5YmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.j06BgQe-n_580q4IbaWLMIQ_uozD7wRbXhygqgvGlqE)

I'll update

||2mdn.net^$media,redirect=noop-1s.mp4:10,domain=open.spotify.com

I have the same as before.

Screen ![2024-01-28_180325](https://github.com/uBlockOrigin/uAssets/assets/111344219/7dad9f3f-e270-416e-ad63-e5c58a305a8e)
stephenhawk8054 commented 4 months ago

Yeah, the ads connections look quite random. Sometimes I got scdn.co, few times I saw 2mdn.net

stephenhawk8054 commented 4 months ago

Can anyone test if this filter can stop any media ads from appearing?

open.spotify.com##+js(trusted-replace-fetch-response, /\,\{"metadata":\{"uri":"spotify:ad:.+?:"AD"\}/, , track-playback)
Luminous-Journey commented 4 months ago

As i mentioned in #22258, i didn't have any issues with visual adds showing up but the songs would start skipping, and whats really irritating is that it doesn't happen every time

stephenhawk8054 commented 4 months ago

@Luminous-Journey Can you do these steps (follow strictly the step order, don't mix the steps orders, or skip any steps):

  1. Click on uBO icon > ▤ "The logger" icon, it will open a logger window
  2. Open new tab and reproduce the issue
  3. Switch to the logger window that was opened in step 1
  4. Copy the logger via 📋 export/copy button at the top right
  5. Paste the logs to https://www.logpasta.com
Luminous-Journey commented 4 months ago

Unfortunately, while i was attempting to troubleshoot, the bug fixed itself and now i cant record it until it happens again, and who knows when that will be, but when it does i will do as recommended

and when i say fixed itself, i mean it stopped happening in that instance and this has been a recurring issue

Luminous-Journey commented 4 months ago

Also @stephenhawk8054 do you want the markdown or plaintext version?

stephenhawk8054 commented 4 months ago

@Luminous-Journey Any is fine.

Luminous-Journey commented 4 months ago

Another bug that i ran into with the same config is when a song is playing like an ad where you cant skip forward and it says advertisment in the bottom right, managed to record this one

log: https://www.logpasta.com/paste/91b347d8-8925-4e30-9fc8-eb17e5db82f5

screenshot: image

stephenhawk8054 commented 4 months ago

Looks like you opened the logger after loading the page. The right steps are opening the logger first and reproducing the issue at the website later (step 1 -> step 2)

Luminous-Journey commented 4 months ago

some more stuff got logged after a min or so https://www.logpasta.com/paste/94e5ae94-6fd5-4a56-afd8-3366cc89b71c

Luminous-Journey commented 4 months ago

I've had the logger open since you suggested recording the issue in case i ran into another issue

stephenhawk8054 commented 4 months ago

Step 2 -> step 3 means you need to switch from the spotify page to the logger. Don't load any other sites and switch from that site to the logger

Luminous-Journey commented 4 months ago

So the logger only logs when its in the foreground of the page attempting to be logged?

stephenhawk8054 commented 4 months ago

The logger needs to be opened first to start capturing information. Then depending on which tab you are opening, it will show the information from that tab. You can switch the tab in the logger's drop down.


@Luminous-Journey But anyways, can you do these steps:

Then can you test these filters?

open.spotify.com##+js(trusted-replace-fetch-response, /\,\{"metadata":\{"uri":"spotify:ad:.+?:"AD"\}/, , track-playback)

Click on uBO icon > ⚙ Dashboard button > Add the filter(s) in "My filters" pane > ✓ Apply changes > Open new tab and test again.

Please also double-check again to see if the filters are marked as valid or invalid (it will show red line if invalid, otherwise it's good).

Luminous-Journey commented 4 months ago

The filter seems to be valid, I will post back here if something happens again. Tysm

Luminous-Journey commented 4 months ago

The logger needs to be opened first to start capturing information. Then depending on which tab you are opening, it will show the information from that tab. You can switch the tab in the logger's drop down.

Thats good, I had the dropdown set to the spotify tab, and had opened the logger before reloading that page

dportvine commented 4 months ago

Can anyone test if this filter can stop any media ads from appearing?

open.spotify.com##+js(trusted-replace-fetch-response, /\,\{"metadata":\{"uri":"spotify:ad:.+?:"AD"\}/, , track-playback)

This scriplet breaks the player on my side.

Screen ![2024-01-29_094811](https://github.com/uBlockOrigin/uAssets/assets/111344219/e93f6fb6-e6e8-4aad-bcb7-447e1f2dc840) ![2024-01-29_094853](https://github.com/uBlockOrigin/uAssets/assets/111344219/6d968ace-bc2a-43f2-b110-7297aa4db50c)
Video https://github.com/uBlockOrigin/uAssets/assets/111344219/f125c8c0-88a7-40fa-b591-15e8344c870d
stephenhawk8054 commented 4 months ago

@dportvine Keep the above filter, can you continue adding this?

open.spotify.com##+js(trusted-replace-fetch-response, "disallow_seeking":true, "disallow_seeking":false, track-playback)
dportvine commented 4 months ago

Didn't help.

stephenhawk8054 commented 4 months ago

Hmm... I don't know how to resolve more. I can reproduce the issue, but cannot any more after adding that filter

dportvine commented 4 months ago

Nothing has changed for me.

Video https://github.com/uBlockOrigin/uAssets/assets/111344219/d7b52094-a521-4438-8d25-0dc2eaf71b4d
gettysburg commented 4 months ago

We want to avoid code manipulation (i.e. patches) to the site's scripts whenever possible, as this is basically RCE.

RCE, aka remote code execution, is not the correct term here.

The dynamic library from "BlockTheSpot" is patching .css files for example as they are parsed by the browser, in order to achieve a clean UI without the "Explore Premium" button for example, and the same is done with .js files by replacing or changing a JavaScript variable or changing existing JavaScript code, no new code is added and executed, simply existing code with known ad-provider URL's (for example sentry.io) in them is modified, in this example sentry.io is replaced by localhost.

This does not qualify as RCE whatsoever, as all changes are done locally and in the users favor, there is no harm, and no code execution that wouldn't occur otherwise.

Regardless, this was just a suggestion, if this is currently not possible as explained by @stephenhawk8054, then it's okay and the current approach of just playing 1 second noop files is good enough I guess, I managed to find an installer with which BlockTheSpot works, so I don't have to use the web player anymore:

My original ticket on BPS and the solution I found there: [Ticket Link](https://github.com/mrpond/BlockTheSpot/issues/513#issuecomment-1914062706) ![image](https://github.com/uBlockOrigin/uAssets/assets/2256003/8979bca9-3eb7-41c6-9b27-18f0b28a971c)

Thank you regardless @ItsProfessional and @stephenhawk8054 for your hard work, and for your replies :-)

stephenhawk8054 commented 4 months ago

@gettysburg RCE will be determined by the extension store reviewers. You can argue whatever you want, but the final decision is by them. Any potential argument would be a potential issue of wasting time for back-and-forth questions/explanations and potential for delay/deny of future versions' publishing.

gettysburg commented 4 months ago

@stephenhawk8054 I have to admit that I did not take Mozilla's review team into consideration, and the way that these new filters allowing for file modification could be abused by (third party) filter-list maintainers.

Thank you for bringing that up, I totally have not thought of that.

stephenhawk8054 commented 4 months ago

@dportvine This is a POC test, can you test if this skips the ads faster?

open.spotify.com##+js(trusted-replace-fetch-response, '/(\{"uri":"spotify:ad:.+?,"manifest"):.+?,"audio_id":/', '$1:{"file_urls_mp3":[{"bitrate":160000,"file_id":null,"file_url":"https://cdn.jsdelivr.net/gh/stephenhawk8054/external_resources@master/noop-0.1s.mp3","impression_urls":[""],"track_type":"AUDIO","format":null,"audio_quality":null,"hifi_status":null,"gain_db":null,"expires_at":null}]},"audio_id":', track-playback)

The idea is replacing their mp3 ads with an external mp3 file

dportvine commented 4 months ago

The player stopped. Реклама = Ads.

Screen ![2024-01-30_153428](https://github.com/uBlockOrigin/uAssets/assets/111344219/d7d6930c-cec1-4c99-9f0e-883070f40f26)
stephenhawk8054 commented 4 months ago

@dportvine Can you check the logger to see which connections appear at that?

dportvine commented 4 months ago

logger

Screen ![2024-01-30_161047](https://github.com/uBlockOrigin/uAssets/assets/111344219/94731ffc-0df3-470a-8c4e-1bdfdc39c857)
dportvine commented 4 months ago

@stephenhawk8054

This is a POC test, can you test if this skips the ads faster?

open.spotify.com##+js(trusted-replace-fetch-response, '/(\{"uri":"spotify:ad:.+?,"manifest"):.+?,"audio_id":/', '$1:{"file_urls_mp3":[{"bitrate":160000,"file_id":null,"file_url":"https://cdn.jsdelivr.net/gh/stephenhawk8054/external_resources@master/noop-0.1s.mp3","impression_urls":[""],"track_type":"AUDIO","format":null,"audio_quality":null,"hifi_status":null,"gain_db":null,"expires_at":null}]},"audio_id":', track-playback)

The idea is replacing their mp3 ads with an external mp3 file

I checked again. And now I don't see any problems.

Video https://github.com/uBlockOrigin/uAssets/assets/111344219/9da20ef3-2f79-48e6-a9d3-9e6ac8b614ea
Luminous-Journey commented 3 months ago

As i mentioned in #22258, i didn't have any issues with visual adds showing up but the songs would start skipping, and whats really irritating is that it doesn't happen every time

I managed to get that one issue logged where the songs just skip instead of playing @stephenhawk8054 https://www.logpasta.com/paste/c7f016dd-bd30-4c9a-977f-56f8f0a2af69

Luminous-Journey commented 3 months ago

But now it's fixed itself again... I hate inconsistency when attempting to debug

stephenhawk8054 commented 3 months ago

@Luminous-Journey Remove the custom filters I told you to test and check if your original issue is still there or not.

If I understand correctly, your original issue is the player was stuck and could not advance right?

Luminous-Journey commented 3 months ago

It would advance, but it would simply skip all the subsequent songs instead of playing them

stephenhawk8054 commented 3 months ago

@Luminous-Journey That's strange. For now just remove the current custom filters and see if the issue is still there or not. Also check your other extensions if possible too.

Luminous-Journey commented 3 months ago

You mean this one? open.spotify.com##+js(trusted-replace-fetch-response, /\,\{"metadata":\{"uri":"spotify:ad:.+?:"AD"\}/, , track-playback)

or the lists?

stephenhawk8054 commented 3 months ago

@Luminous-Journey Yeah, the ones I told you to add in My filters. I don't remember how many you are using now.

Baysul commented 3 months ago

image The element is named ##.sponsor-container or something along those lines, according to uBlock Origin's element picker. Seems somewhat inconsistent; I found this one in my Discover Weekly playlist but not in other playlists.