uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
944 stars 80 forks source link

[FEAT] Test domain against filter lists in extension #3362

Closed micsthepick closed 1 month ago

micsthepick commented 2 months ago

Prerequisites

I tried to reproduce the issue when...

Description

I would like to test a simple list I have written, to see if the domain(s) I want to block and not to block are working as intended. Ideally I'd like to not actually visit e.g. a malware or phishing domain if all I want to do is block it and ensure that the extension is working correctly

A specific URL where the issue occurs.

ANY

Steps to Reproduce

  1. Import a list (optional)
  2. Visit a site that should be blocked

Expected behavior

  1. Import list as above
  2. somewhere in the extension, test domain
  3. observe whether the domain is blocked, and where in the lists the appropriate rules are applied, like as if viewing a log entry

Actual behavior

oops, I visited the site, accidentally because the list was written wrong.

uBO version

Latest (1.59.0 as of writing)

Browser name and version

Any

Operating System and version

Any

garry-ut99 commented 2 months ago

Duplicate of:

unless you have seen that thread already, and you were inspired by it, and you still want to embed the solution into uBO itself to be even better.


Also another idea for your problem is to put the same domain list not only into uBO, but also into Hosts file: if uBO fails to block a domain, you will see that in uBO logger, but the domain will be still blocked by Hosts file outside browser.

micsthepick commented 2 months ago

unless you have seen that thread already, and you were inspired by it, and you still want to embed the solution into uBO itself to be even better.

The above is a discussion, which is why when I did a "cursory search" for simillar issues I didn't find anything. To be clear I didn't see that discussion until you linked it. You seem to be very agressive toward me, but I will take that as potentially a language barrier. From now on I request that you please assume good faith from me.

krystian3w commented 2 months ago

If you have not disabled "strict block" boards in the configuration, you can open these links to malware and scams in an isolated environment.

||phishing.bar^$all
/malware/path$all

The chances of being allowed to use (exception), or a globally disabled "strict block", or the popular badfilter construction (needed modify filter to again run) are rather low.

I definitely recommend an isolated environment when you don't block so that it's a "strict block" board - for example, I am unable to block download assistants with adware with simple web filters e.g. on dead vortal http://download.komputerswiat.pl/ (live maybe on www.dobreprogramy.pl if we disable KAD anti scams).

micsthepick commented 2 months ago

@krystian3w if I understand what you are saying, my one critique of that is that an isolated env. is going to be far more effort to spin up one for maybe a couple of domains in my use case (writing a few rules at a time).

garry-ut99 commented 2 months ago

micsthepick: You seem to be very agressive toward me,

Not me, you. I don't know why are you so "aggressive", to the point you accused me of being "aggressive" and sticked a thumb down emoji to a useful comment, only because I tried to help, but maybe take a breath and calm down, I don't know what wrong's or bad in informing about existence of the same thread, there seem only benefits: useful information, by the way, you will learn to search the discussions next time as well.

micsthepick: but I will take that as potentially a language barrier.

Oh, so you have problems with language barrier, then you need to work on your language barrier. Btw you seem to be another case like the guy from the previous thread: #3359

micsthepick: From now on I request that you please assume good faith from me.

It's rather me who advise you (and the other guy) that.

(By the way: I only defend against that guy, I hope he will not continue, and that it's all over, also if mods want to hide comments, hide the both comments (my and that guy's) or none, as allowing comments with personal attacks, and hiding comments which are only defense, wouldn't be fair))

krystian3w commented 2 months ago

Maybe someone can advise you on how to pretend that there is network traffic without deactivating the network card and real tabs with address bar (maybe commands to standard devtools).

micsthepick commented 2 months ago

I don't know what wrong's or bad in informing about existence of the same thread

the only thing I found aggressive was "unless you have seen that thread already, and you were inspired by it, and you still want to embed the solution into uBO itself to be even better." not anything else. Is that presumption?

It's also a bit ironic that you link to a post where you call someone a clown and yet continue to call me aggressive.

gorhill commented 2 months ago

In the meantime, a workaround to test various URLs is to use the format used by the benchmarkDatasetURL advanced setting. Create a JSON file where each line matches the following format:

{"frameUrl":"https://www.guildwars2.com/en/","url":"https://www.google-analytics.com/analytics.js","cpt":"script"}

frameUrl is the context from within which url is fetched. cpt is the type of the resource (I am not sure what cpt means, the format comes from Ghostery benchmark data).

Set benchmarkDatasetURL to the URL of the file, for example file:///home/.../path/to/requests.json, then go to dashboard, Support, click More, then click SNFE: Benchmark. This will load the file and evaluate each JSON line through the static network filtering engine. This won't be reported in the logger because the benchmark is meant to measure performance in normal condition, but the number of blocked/not blocked requests will be reported.

When the content of the JSON file is changed, best to restart uBO to ensure is not using the older version as it holds onto the last loaded version for a while to avoid overhead of reloading the file everytime we click benchmark/report buttons.

gorhill commented 2 months ago

This can now be done in dashboard => Support => More button, by using the snfe? prompt in the text editor.

Please refer to commit message for usage: https://github.com/gorhill/uBlock/commit/b7ed3b45ed

garry-ut99 commented 1 month ago

https://github.com/uBlockOrigin/uBlock-issues/issues/3362#issuecomment-2324035883

Again. I didn't call him names (not as first), he did call me names. Even if I said something which he didn't like or didn't understand, Me, as a valuable volunteer here, didn't deserve to be called names, and he could express his opinion without calling names. The same applies to this comment as well: https://github.com/uBlockOrigin/uBOL-home/issues/199#issuecomment-2333765474. Not to mention that their comments have been not hidden (not all), while my have been hidden, which is nothing more than inconsistency in moderation. They both + moderation acted like aggressive jackasses towards me.