Comments (4)
BTW, after fixing this bug I found another bug. Fixing this bug made check_ws_vs_http_matching
failing.
The test looks like this:
let network_filter = NetworkFilter::parse("|ws://$domain=4shared.com", true).unwrap();
assert!(network_filter.matches(&request::Request::from_urls("ws://example.com", "4shared.com", "websocket").unwrap()));
Changing "4shard.com"
to http://4shared.com
fixed the problem. Now there is a question here. Does a WebSocket send an http referrer in a URL format or it is just a domain. If it will always send a URL, we should fix the tests to a URL rather than a domain. If there is a possibility they send domains, there is a problem with parsing the source_url from the domain (which is reasonable), and we need to fix that. Either way, I think we should add negative tests there to show that there is a bug right now.
As a piece of evidence, the following code passes.
let network_filter = NetworkFilter::parse("|ws://$domain=4shared.com", true).unwrap();
assert!(network_filter.matches(&request::Request::from_urls("ws://example.com", "3shared.com", "websocket").unwrap()));
from adblock-rust.
It raises another question. Now that I think about it, why do we even compare it against the source_url
and not against the URL of the request? When the request_url
is an absolute URL, the comparison should be against the URL and not against the source URL.
from adblock-rust.
Good catches, That check_ws_vs_http_matching
test is definitely wrong, those need to be full URLs.
If I understand your last question correctly, we need source_url
because there are some rules which are applied differently depending on the page the request is made from. For example, ||a.com$domain=b.com
will only block requests to a.com
made from b.com
. It's also taken into account for $first-party
and $third-party
options.
Since check_network_urls
really depends on source_url
to make a correct decision, there should realistically be an error returned if it's not supplied, or doesn't parse correctly.
I'm not actually that familiar with WebSocket referrers, but it shouldn't matter - source_url
should just be the top-level URL of the page from which the WebSocket was initiated.
from adblock-rust.
If you need any help with fixing the bug, I'd be happy to help.
from adblock-rust.
Related Issues (20)
- Support for `Permissions-Policy` modifier
- Convert $all to $doc like uBO HOT 1
- support AdGuard scriptlet syntax HOT 1
- Will adblock-rust continue to work after Chrome Manifest V3? HOT 3
- `:style()` action operator doesn't work great with some `::-webkit-*` pseudo-classes, if other pseudo classes are used/need in the same rule.
- Support for `$specifichide`
- YouTube blocks default Brave now HOT 2
- Ag filters support of Brave Shields.
- Copyright confusion HOT 9
- Investigate using upstream `url` parser
- uBlock filter not working on Brave, works on Firefox + uBlock HOT 2
- Missing `from` support on `content_blocking.rs` causes crashes
- Wrong types for js bindings HOT 2
- Dependency Dashboard
- Return all filters which blocks the request HOT 1
- Allow specific YouTube channels with the AdBlock HOT 2
- crate.io website doc license tag needs an update
- `remove-attr`/`remove-class` regex/quoted syntax
- `$to` support
- Element hiding rules (cosmetic filters) do not work with regex
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adblock-rust.