-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adguard does not block WebSocket connection #203
Comments
More information about web sockets in FF add-on: Maybe these requests go through nsIContentPolicy, we should simply check it first. |
Some information about Chrome: Quote from there:
|
Example:
![image](http://imagizer.imageshack.com/img924/4999/IAAYiF.png)
ws://wsp.marketgid.com:8040/ws
|
So it's not possible for now? |
Why? My comment describes how it is possible. |
Documentation: Some important notes on it
Other option: change URL in the original websocket to 127.0.0.1 so it will throw connection error naturally. |
@ameshkov I wrote such wrapper to expose WebSocket connection (ref), using as a standalone "companion" extension. I am considering making the extension more generic so as to not cater to one specific blocker, but to rather have the purpose of being useful to any blocker which supports it. It could already be used by AdGuard, requiring only the few lines of code to be added to AdGuard. If this is of interest to you, we could re-work the project:
Advantages I see of one extension serving all blockers:
Obviously, the root issue being fixed in Chromium would be the best, but so far the issue has been left untouched for years. |
Hi @gorhill! Thanks for notifying me! Just a few questions on this.
window.postMessage just looks like a more "generic" way of doing this. Also, as I understand, we have the same issue with FF add-on, nsIContentPolicy events do not fire on WS requests. Not sure about nsIObserver yet. Btw, I just got an idea. Both ways are currently vulnerable as site owner can easily override
Yeah, that's highly unlikely:) |
In the current case, using
Good point.
I got skittish with this after I broke prominent sites last Monday with this solution. Granted, this was entirely my fault with a poorly tested and hald-assed implementation. But ideally yes, it's best if it's part of the extension itself, as I believe most users would not know they have to install another extension to gain the ability to block websocket connections. Your idea of library is probably best in this case, it can be used as see fit by blocker extensions. For the time being, given how I broke things last Monday, I would stick to a companion extension on my side, but will end up relying on that shared library. Currently I find it annoying to write the code in a string, but I can see no other way to ensure the WebSocket wrapper is injected at earliest in the web page. Probably best to have an extension building step to fill in that string from the lib. Ideally, using So anyways I just spinned off the WebSocket wrapper code in a standalone file, which will be the library: https://github.com/gorhill/chromium-websocket-wrapper. I am pretty open if you rather have the project maintained elsewhere, or regarding js style, etc. |
Yes, a HTTP observer can see WebSocket requests on Firefox. |
Look at what @Mizzick has done in the last commit: So, basically:
|
Any idea which websites are good for WS wrapper testing? |
Let's just make it a bit more "modular" and contribute together (if you're ok with a hell of a lot of comments, i just like to comment every function). Something like this:
|
I know of these two, they use websockets to retrieve images:
Be sure to test the sites which were reported broken (but fixed since then with the new wrapper code):
|
I completely agree, the only reason I removed the comments is because I had to stringify the code. Also I see I left |
@gorhill the "channel" abstraction purpose it to allow others to use any messaging, not just through an image. If @Mizzick is able to make window.postMessage work well, we'd better stick with it. One more thing on the "image" way. User may turn images off for the websites, blocking WS as well. So, in the library we can simply have two channel implementations, |
…1266-1_fix to feature/redesign * commit 'c6ee14bfee51fa4045af5d4eed3a0ab0e587fd7d': feature/1266-1_fix
Refresh this page a couple of times:
http://seasonvar.ru/serial-13138-Ostrov_rus.html
Until you see this script there:
It seems that AG does not block WS connections (due to extension manifest I guess, we handle only http and https now).
Relevant discussion on our forum:
https://forum.adguard.com/index.php?threads/adguard-doesnt-block-adverts-on-newsru-com.9734/#post-79210
Websites to test WS is ok (got from this issue: gorhill/uBlock#1604)
The text was updated successfully, but these errors were encountered: