Skip to content
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

Add AdGuard-trusted scriptlets to replace the old JS rules #106

Closed
5 of 8 tasks
ameshkov opened this issue Dec 2, 2020 · 15 comments
Closed
5 of 8 tasks

Add AdGuard-trusted scriptlets to replace the old JS rules #106

ameshkov opened this issue Dec 2, 2020 · 15 comments

Comments

@ameshkov
Copy link
Member

ameshkov commented Dec 2, 2020

https://github.com/AdguardTeam/AdguardFilters/blob/master/AnnoyancesFilter/sections/cookies_specific.txt#L4707

There are tons of JS rules in the Annoyances filter that deal with cookie consent screens.

We should find a way to use scriptlets for that. We may need to introduce a "trusted" type of scriptlets for that, allowed to the user filter and our filter lists only, i.e. trustLevel: full.

@ameshkov ameshkov added the enhancement Improvement of existent feature label Dec 2, 2020
@ameshkov ameshkov added this to the 1.5 milestone Dec 2, 2020
@ameshkov
Copy link
Member Author

ameshkov commented Dec 8, 2020

I'll keep a checklist with categorized ideas in the top comment.

But I'll need examples for every kind of it.

@slavaleleka
Copy link
Contributor

I suggest to mark new AdGuard-trusted scriptlets with a prefix ag- or agtrusted- so final names will be like ag-set-cookie-free or agtrusted-click-element. they also should have no aliases to emphasize that there are no analogs and as a result to prevent converting and supporting in third-party filters lists

@ameshkov
Copy link
Member Author

ameshkov commented Dec 22, 2020

Let's go with trusted-, it's a bit longer, but the meaning is clearer.

@AdamWr
Copy link
Member

AdamWr commented Feb 25, 2021

Regarding creating bait elements, I think that at the moment this website might be a good example - AdguardTeam/AdguardFilters#75764
Their script is obfuscated, but if I understand correctly, they are doing something like:

if ( document.getElementsByClassName("mghead").length < 1 ) {
    console.log("adblock detected");
}

so creating element with class mghead fixes anti-adblock.

@bestpika
Copy link

bestpika commented Mar 9, 2021

Can you please add sessionStorage along with it? #118

@slavaleleka slavaleleka changed the title Come up with new scriptlets spec to replace the old JS rules Add AdGuard-trusted scriptlets to replace the old JS rules Aug 5, 2021
@slavaleleka slavaleleka modified the milestones: 1.5, 2.0 Jan 12, 2022
@adguard-bot adguard-bot added this to the 2.0 milestone Jan 13, 2022
@slavaleleka
Copy link
Contributor

Adblock Plus has a snippet simulate-event-poc which is related to click-an-element subtask
abp-filters/abp-filters-anti-cv@246d6ae

@ameshkov
Copy link
Member Author

@slavaleleka this one is interesting, but it should definitely be limited to trusted lists only.

@krystian3w
Copy link

ABP still support all snippets form only anti-cv file or from own addons settings in place "my added rules".

So no need fastly write system for privileges (can wait as mark use other snippet as safe loaded form any filter list file).

@ameshkov
Copy link
Member Author

We're adding support for "trusted" scriptlets to CoreLibs: AdguardTeam/CoreLibs#1612

Once it's added, we should start working on the new scriptlets.

@krystian3w
Copy link

I suppose all world wait for official syntax.

adguard pushed a commit that referenced this issue Apr 15, 2022
…-100 to master

* commit '4bf88bcbcbe0e165e3c56fd35a687348a6c0a439':
  upd builds
  upd builds
  AG-100: typescript support
@AdamWr
Copy link
Member

AdamWr commented Aug 22, 2022

Regarding setting HTML elements attributes, it would be useful if we could also set attribute by getting one of the current attributes from element.

For example, here - https://hdfilmifullizle.com/13-mezar-izle
This website stores video source in data-sonrayukle attribute (and add src attribute after an ad is finished), so that would be nice, if we could also in this scriptlet get attribute from an element and add src attribute with that attribute.

Screenshot

image

@stanislav-atr
Copy link
Contributor

These were implemented in 1.7.3 release:

  • trusted-click-element
  • trusted-replace-xhr-response
  • trusted-replace-fetch-response
  • trusted-set-local-storage-item
  • trusted-set-cookie

The rest will be added in 1.8

@slavaleleka
Copy link
Contributor

slavaleleka commented Jan 9, 2023

@Yuki2718
Copy link

Regarding setting HTML elements attributes, it would be useful if we could also set attribute by getting one of the current attributes from element.

With this we can replace script rules for AdguardTeam/AdguardFilters#132525, AdguardTeam/AdguardFilters#132814, AdguardTeam/AdguardFilters#135699
Maybe should add TODO comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants