Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

steamcommunity.com: breakage #156

Closed
growf opened this issue Jul 27, 2024 · 28 comments
Closed

steamcommunity.com: breakage #156

growf opened this issue Jul 27, 2024 · 28 comments
Labels

Comments

@growf
Copy link

growf commented Jul 27, 2024

OS: macOS Sonoma 14.5 (23F79)
Browser: Google Chrome 126.0.6478.127 (Official Build) (arm64)
Extension: uBlock Origin Lite 2024.7.17.853

Following a link from a Discord server to https://steamcommunity.com/id/customurlasd/myworkshopfiles/?appid=293760 is blocked despite being a genuine page on the Steam Community Workshop. uBOL blocks the link unless the filtering mode for steamcommunity.com is set to "No filtering".

The URL isn't blocked if cut-and-pasted directly into the browser's URL bar; the block only occurs when following a link from a Discord server. I believe it is being caught up in the attempt to block fraudulent links used in Discord Nitro scams.

Issue can be worked-around by cut-and-pasting the URL in the URL bar or by disabling filtering for steamcommunity.com.

Edit: Issue appears not to be restricted to Discord links; even the link in this comment results in the page being blocked.

@MasterKia MasterKia changed the title Discord anti-fraud filter blocking genuine links steamcommunity.com: breakage Jul 27, 2024
@MasterKia
Copy link
Member

#155?

@growf
Copy link
Author

growf commented Jul 27, 2024

#155 doesn't have the specific replication steps that this issue does; this ticket is specifically related to Discord links to steamcommunity.com

Additionally, I am not running a second ad-blocker.

@growf
Copy link
Author

growf commented Jul 27, 2024

Huh. Even the link to steamcommunity.com from this ticket's description is blocked. I'll update the description to note that.

@gorhill
Copy link
Member

gorhill commented Jul 27, 2024

Issue can be worked-around by cut-and-pasting the URL in the URL bar or by disabling filtering for steamcommunity.com

Or just forcing a reload of the page by clicking "Reload" button in browser error page.

Will have to figure out which DNR rule is causing this.

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Jul 27, 2024

@gorhill There's a regex filter in badware related to it

/^https:\/\/stea[a-z]{1,4}o[mn][a-z]{4,7}y[a-z]?\.com\//$doc,domain=com|~steamcommunity.com

Could it cause issue because DNR does not support ~ yet?

@gorhill
Copy link
Member

gorhill commented Jul 28, 2024

DNR does support ~, the rule is here using excludedInitiatorDomains: https://github.com/uBlockOrigin/uBOL-home/blob/main/chromium/rulesets/regex/default.json#L99. It could be though that the initiator is evaluated differently in DNR.

Note that I cannot reproduce when compiling the extension locally, so it seems a filter which was removed is causing this. In the network pane, it says initiator is other.

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Jul 28, 2024

Hmm... even when I modify the link to just https://steamcommunity.com in the devtools, it's still blocked after clicking. But weird that the document when reloading is fine.

@gorhill
Copy link
Member

gorhill commented Jul 28, 2024

Weird, I cannot reproduce with locally-compiled and sideloaded MV3 in Chromium, but can reproduce with locally-compiled and sideloaded MV3 in Firefox.

I can reproduce when sideloading both latest release for Chromium and Firefox.

Will need a way to report triggered rules at the console to figure out which rule is causing the issue.

@gorhill
Copy link
Member

gorhill commented Jul 28, 2024

Turns out my sideloaded Chromium version was suffering from an unrelated bug related to entering all-urls in the "No filtering" field, preventing me from reproducing locally in Chromium. Removing the all-urls from the "No filtering" field did not cause the rule which disables blocking everywhere by default to be removed. This will have to be fixed separately.

Now I can reproduce locally in Chromium, and the reported rule which is causing the issue is:

[uBOL] https://github.com => https://steamcommunity.com/id/customurlasd/myworkshopfiles/?appid=293760
	[{"action":{"type":"block"},"condition":{"excludedInitiatorDomains":["steamcommunity.com"],"initiatorDomains":["com"],"regexFilter":"^https:\\/\\/stea[a-z]{1,4}o[mn][a-z]{4,7}y[a-z]?\\.com\\/","resourceTypes":["main_frame"]},"id":1000071}]

So the issue is that the initiator as seen by the DNR API is github.com.

@stephenhawk8054
Copy link
Member

Hmm... DNR initiator is quite different than what I expected. I thought it means the context of the page. Didn't know it means the page before that.

@stephenhawk8054
Copy link
Member

I'll use !env_mv3 as a temp solution

stephenhawk8054 added a commit to uBlockOrigin/uAssets that referenced this issue Jul 29, 2024
@gorhill
Copy link
Member

gorhill commented Jul 29, 2024

I think using to=com|~steamcommunity.com instead of domain=com|~steamcommunity.com should work.

@stephenhawk8054
Copy link
Member

Hmm... I'm still not clear about DNR domain. For example there's a filter in badware list like this

/\/[0-9a-f]{32}\/maq\/$/$doc,match-case,domain=com|top

If a user visits

https://example.org

then click on a link that is

https://example.com/11111111111111111111111111111111/maq/

so would the maq link be blocked? The domain here will be referred to https://example.com or https://example.org?

@gorhill
Copy link
Member

gorhill commented Jul 29, 2024

Since the filter is targeted at document requests, using to= make more sense in that case since you want to block the request regardless of its initiator -- this will make the filter work properly in uBOL Lite while still working properly in uBO.


so would the maq link be blocked?

Yes, the link will be blocked when using to=com|top.

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Jul 29, 2024

Hmm... Currently there are a lot of filters with domain and doc, so are they all potentially having issues in uBOL?


Also there's a weird situation I'm getting, related to doc and domain while I was testing with the above example.org: currently this link is blocked properly in uBO: https://example.com/c/a?s1=1 due to the filter

.com/c/*?s1=$document,domain=com

But when I open it in uBOL, it's not blocked, although the filter is compiled to DNR normally

{"action":{"type":"block"},"condition":{"initiatorDomains":["com"],"resourceTypes":["main_frame"],"urlFilter":".com/c/*?s1="},"id":10772}

I found that when I modified the link "More information" in https://example.org to https://example.com/11111111111111111111111111111111/maq/ and clicked on it, the link was not blocked. Then I just loaded the whole link in the URL bar and it's not blocked either.

@gorhill
Copy link
Member

gorhill commented Jul 29, 2024

But when I open it in uBOL, it's not blocked

Yes, because the initiator can be something else than what domain= specify, hence the issue here. When clicking the link at the top, initiator is github.com, hence matching domain=com|~steamcommunity.com, hence causing the unwanted block. If using to=com|~steamcommunity.com, then the destination document is what will be matched, hence steamcommunity.com, which will not match to=com|~steamcommunity.com. When loading the URL directly in the address bar, the initiator is undefined, hence not matching domain=com|~steamcommunity.com.

When using to= for filter using document, initiator is disregarded and instead the hostname of the document URL is what is matched, so you will always get the wanted result. In uBO the issue does not exist with domain= because uBO always set the initiator to the top document navigated to.


Currently there are a lot of filters with domain and doc, so are they all potentially having issues in uBOL?

Difficult to say given that it's arising as per DNR API internals -- we should just fix on a per-report basis to avoid filter regression.

@stephenhawk8054
Copy link
Member

Thanks. It's more complicated than I expected now that I think about the filters which have both domain and to.

cc @Yuki2718 , these may be useful for badware list.

@gorhill
Copy link
Member

gorhill commented Jul 29, 2024

Just to be clear, domain= is still needed for filters targeting resources other than document.

@stephenhawk8054
Copy link
Member

Yeah I understand. The only tricky ones are document and maybe all? There are some filters like

||fitgirl-repacks.*^$all,domain=~fitgirl-repacks.site,to=~fitgirl-repacks.site

that I'm not actually sure how it will perform in uBOL.

@gorhill
Copy link
Member

gorhill commented Jul 29, 2024

not actually sure how it will perform in uBOL

If you build uBOL from the console, the lists will be downloaded and cached in dist/build/mv3-data and once cached, a list will not be dowloaded again so you can add a filter in dist/build/mv3-data/badware.min.txt for example, then if you build again using make mv3-[chromium|firefox], your filter will make it into the DNR rules of your local build so you can test the result.

@Yuki2718
Copy link

Yuki2718 commented Jul 29, 2024

I guess we need to change a lot of $domain to $to then. Not only Badware, I have to change Japanese filter too (confirmed the behavior is the same for AGMV3).

gorhill added a commit to gorhill/uBlock that referenced this issue Jul 29, 2024
A new icon has been added to the popup panel, to open a popup
window with a terse list of DNR events for the current tab, in
reverse chronological order (most recent DNR event appears at
the top).

The new ability is available only when the extension is sideloaded,
as per `declarativeNetRequestFeedback` documentation. Ref:
https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#event-onRuleMatchedDebug

Purposefully minimal, so as to have something rather than nothing
when having to diagnose filtering issue with the DNR API. Example:
uBlockOrigin/uBOL-home#156

The content of the popup window does not dynamically update, force
a refresh (F5) to get the most recent DNR events. This might be
improved in the future.

The DNR event buffer is not persisted, so the buffer is empty when
service worker is restarted. This might be improved in the future
by using session storage API.

There is no output filtering ability in this first draft. This
might be improved in the future.

DNR rules are reported. The filter from which a DNR rule
originates is not reported. Given that the rulesets are optimized
after conversion from original filter lists to reduce the DNR rule
count, this is unlikely to ever be possible.
stephenhawk8054 added a commit to uBlockOrigin/uAssets that referenced this issue Jul 31, 2024
@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Jul 31, 2024

Confirm switching from doc,domain= to doc,to= works.

cc @Yuki2718 We can gradually switch to this format

stephenhawk8054 referenced this issue in uBlockOrigin/uAssets Jul 31, 2024
gorhill added a commit to gorhill/uBlock that referenced this issue Aug 1, 2024
@gorhill
Copy link
Member

gorhill commented Aug 5, 2024

@stephenhawk8054
Copy link
Member

@gorhill Hmm... About domain and to issue, is removeparam affected the same? Many of the filters in "AdGuard URL Tracking Protection" is like this:

.com/*/status/$removeparam=t,domain=twitter.com|x.com

Should they be changed to .com/*/status/$removeparam=t,to=twitter.com|x.com ?

@gorhill
Copy link
Member

gorhill commented Mar 3, 2025

Yes.

I get expected result when using ?appid=$removeparam=appid,to=example.com and either clicking or copy-pasting into address bar https://example.com/?appid=toto, and unexpected result when using ?appid=$removeparam=appid,domain=example.com.

@gorhill
Copy link
Member

gorhill commented Mar 3, 2025

I could internally convert domain= to to= in uBOL for removeparam option. Can't do this for removeparam since the option can be used for other resources than document.

Same for csp=.

gorhill added a commit to gorhill/uBlock that referenced this issue Mar 3, 2025
@stephenhawk8054
Copy link
Member

@gorhill I think converting domain to to for csp is not a good idea. There are filters that target iframes in a specific site, so converting domain to to would cause incorrect targets for these filters, for example:

@@||recaptcha.net^$frame,csp=worker-src 'none',domain=lewd.ninja

@Yuki2718
Copy link

Yuki2718 commented Mar 4, 2025

AGMV3 doesn't remove either. I'll open an issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants