Skip to content

Conversation

@NeverBehave
Copy link
Contributor

@NeverBehave NeverBehave commented Nov 17, 2022

URL(s) where the issue occurs

https://blog.skk.moe/

Describe the issue

The params in the fetch is lower case while the filter is upper case.

Notes

I believe the root cause is because no-fetch-if does not support case insensitive (require extra params if build regex from string), while in fetch() you could pass PoSt as method while still have correct behavior but bypass the filter. A separate issue for uBlock may be required.

Related https://github.com/gorhill/uBlock/blob/b6ed83bc5c840431ed03cddaed1daeb395db3b0e/assets/resources/scriptlets.js#L609

@mapx- mapx- merged commit a2d5c69 into uBlockOrigin:master Nov 17, 2022
@NeverBehave
Copy link
Contributor Author

Currently, method: Post is used and this filter is thus invalidated. Just a head up for anyone who cares about this specific site.

@mapx-
Copy link
Contributor

mapx- commented Nov 20, 2022

does this help ?

skk.moe##+js(no-fetch-if, body:/[\w\W]{700}/)

@NeverBehave
Copy link
Contributor Author

NeverBehave commented Nov 20, 2022

@mapx- I am not entirely sure what this filter is based on (a key in the body?). I would like to find a way to stop a kind (verb) of request (reading a blog imo doesn't need to POST anything in the background), and right now I can't find any effective way to achieve this goal.

@mapx-
Copy link
Contributor

mapx- commented Nov 20, 2022

Test for breakage

skk.moe##+js(aopr, btoa)

or

skk.moe##+js(aost, Number.isNaN)

or

skk.moe##+js(aost, fetch, /A\s.*/)

I see no POST anymore.

@NeverBehave
Copy link
Contributor Author

skk.moe##+js(aopr, btoa) this one seems work well as only tracking used it.

@SukkaW
Copy link
Contributor

SukkaW commented Dec 5, 2022

@mapx-

And you are just breaking following page:

Those pages are using ECharts library which uses window.btoa.

@uBlock-user
Copy link
Member

I believe the root cause is because no-fetch-if does not support case insensitive (require extra params if build regex from string), while in fetch() you could pass PoSt as method while still have correct behavior but bypass the filter.

@gorhill this needs to be addressed...

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Nov 16, 2025

##+js(no-fetch-if, method:/post/i) will work.

@uBlock-user
Copy link
Member

##+js(no-fetch-if, method:/post/i) will work.

It doesn't.

@gorhill
Copy link
Member

gorhill commented Nov 16, 2025

What filter doesn't work where?

@uBlock-user
Copy link
Member

@gorhill Add blog.skk.moe##+js(no-fetch-if, url:post) and/or blog.skk.moe##+js(no-fetch-if, method:/post/i) and browse to blog.skk.moe, observe that fetch request of method:post is fired and with url having post string in it despite having the filter/s to defuse both. Both filters get bypassed.

@gorhill
Copy link
Member

gorhill commented Nov 16, 2025

The site uses an object with non-enumerable properties as the fetch's options argument, so the scriptlet can't "see" these options. Maybe one way to counter this is to at least explicitly lookup common properties instead of just using Object.assign.

@SukkaW
Copy link
Contributor

SukkaW commented Nov 17, 2025

The site uses an object with non-enumerable properties as the fetch's options argument, so the scriptlet can't "see" these options. Maybe one way to counter this is to at least explicitly lookup common properties instead of just using Object.assign.

Let's leveling the playing field a little bit: one of the proper ways to do this is to use Object.prototype.hasOwnProperty.call to look up the property first, then explicitly reading the value, which is what AdGuard's scriptlet does. Object.getOwnPropertyNames could also be a good alternative if you wish to stay with for ... in ....

gorhill added a commit to gorhill/uBlock that referenced this pull request Nov 17, 2025
@exzzzzzzz
Copy link

1.67.1b5 This version broke the test. https://www.cloudflare.com/ru-ru/ssl/encrypted-sni/#results

gorhill added a commit to gorhill/uBlock that referenced this pull request Nov 20, 2025
Haoxiqiang pushed a commit to Haoxiqiang/uBlock that referenced this pull request Dec 22, 2025
Haoxiqiang pushed a commit to Haoxiqiang/uBlock that referenced this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants