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

Align with uBo scriptlets and resources standards #4392

Closed
3 tasks done
seia-soto opened this issue Oct 26, 2024 · 0 comments
Closed
3 tasks done

Align with uBo scriptlets and resources standards #4392

seia-soto opened this issue Oct 26, 2024 · 0 comments
Assignees

Comments

@seia-soto
Copy link
Member

seia-soto commented Oct 26, 2024

Currently, there're some behaviors that mismatches with uBo: https://github.com/gorhill/uBlock/wiki/Resources-Library . This issue tries to list capabilities that mismathces/unsupported by our adblocker engine. If you have any ideas, please let us know.

We're trying to be close in ad-blocking and filter parsing capabilities as uBo does.

Ongoing roadmap

Tasks

Preview Give feedback
  1. PR: New Feature 🚀
    seia-soto
  2. PR: Bug Fix 🐛
    seia-soto
  3. PR: Bug Fix 🐛
    seia-soto

Current mismatches

Do not skip .js when the scriptlet is used with redirect=, only when used in +js(...).

refs #4393

Parsing object in the scriptlet arguments

We currently parse objects in the scriptlet arguments. For an instance, the following will be regarded as an argument: { "a": 1, "b": 1 }. However, it's not a valid scriptlet arugment since you didn't escaped a comma. We'll drop this object parsing capability in short and try to take some performance headrooms.

Future-wise changes that are expected (NOT decided)

You should omit the .js from the scriptlet name in scriptlet injection filters (eventually in some future this will be the official way to do this).

Since v1.34, we shipped JSON based resources format. This was to support aliasing and more properly, but changed the behavior slightly. Currently, we're handling non-suffixed scriptlet calls by suffixing .js extension.

  • If a scriptlet name has a suffix of .js, we'll query as-is.
  • If a scriptlet name has no suffix of .js, we'll query with .js suffix.

From uBo documentation, it says that we should omit the .js extension. We won't drop support for scriptlet calls without an file extension for now, but we'll drop it when uBo will.

The only filter lists deemed from a "trusted source" are uBO-specific filter lists (i.e. "uBlock filters -- ..."). The user's own filters from "My filters" are trusted only in the dev build of uBO. This behaviour can be overridden with the advanced setting trustedListPrefixes.

We're looking for a best way to implement "trusted sources" and give users a choice. Nothing has been decided so far but we expect users will able to have a feature flag that enables/disables trusted resources, scriptlets, and filters.

Mime type is application/javascript if not present.

We currently don't see a critical breakage regarding this. However, we'll need to decide how an adblocker will react in the future.

@seia-soto seia-soto self-assigned this Oct 26, 2024
seia-soto added a commit to seia-soto/adblocker that referenced this issue Oct 28, 2024
refs https://github.com/gorhill/uBlock/wiki/Resources-Library
refs ghostery#4392
fixes ghostery#4393

test: allow scriptlets being used as resources

fix: allow redirect resources surrogates

test: drop outdated tests

fix: always query with file extension

chore: strictly check content type

test: resources surrogate

test: drop outdated
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

No branches or pull requests

1 participant