@Bot
I only use these regex rules:
Code:
/^(?!.*\.(com|org|it|eu|info|ms|net|io|edu)$).*/##+js(noeval)
/^(?!.*\.(com|org|it|eu|info|ms|net|io|edu)$).*/##+js(aeld, keydown)
/^(?!.*\.(com|org|it|eu|info|ms|net|io|edu)$).*/##+js(aeld, submit)
in uBlock Origin in Chrome and Firefox, and as you can see, NOT in TLDs.
Can you analyze the specific protection provided by the three rules?
Those are uBO
scriptlet injection rules applied with a hostname-regex, so they don’t “block a domain” like a network filter would; they
modify JavaScript behavior on matching pages by defusing specific JS primitives.
0) Scope: what your hostname regex actually matches
Your left-hand side is the same in all three rules:
Code:
/^(?!.*\.(com|org|it|eu|info|ms|net|io|edu)$).*/
In uBO, that regex is matched against the page’s
hostname. The negative lookahead means: apply the rule to any hostname which does
not end with `.com` / `.org` / `.it` / etc.
So it will apply to things like:
- `example.co.uk` (ends with `.uk` → rule applies)
- `example.de` (ends with `.de` → rule applies)
- `example.com.ru` (ends with `.ru` → rule applies)
- `localhost` (no “.com” ending → rule applies)
And it will NOT apply to:
- `example.com` and `sub.example.com`
- `example.org`, `example.net`, etc. (your listed TLDs)
This is an “allowlist by TLD ending”, not an assessment of trustworthiness. Plenty of malicious content lives on “allowed” TLDs too, and many legitimate sites use “not allowed” TLDs—so the protection/usability trade-off will be very uneven.
---
1) Rule #1: `##+js(noeval)` — what protection it provides
In general, uBO’s `noeval` scriptlet is meant to
defuse dynamic code evaluation primitives—most importantly `eval()` and close equivalents (exact coverage can vary by implementation/version).
What this can help against
- Obfuscated/injected JS that relies on `eval` to unpack and run (common in some malvertising, shady scripts, and some exploit chains).
- Some DOM-based injection patterns where attacker-controlled data is turned into a string and then executed via `eval`/similar.
What it does NOT guarantee
- It does not stop code that never uses `eval` (many attacks don’t need it).
- It does not automatically prevent “DOM XSS” if the page injects attacker HTML directly via DOM APIs (e.g., unsafe `innerHTML`) and uses event handlers or script tags in other ways.
- It won’t prevent a browser-engine memory corruption exploit (that’s a different class of issue).
Usability impact
Some sites (especially older frameworks, certain analytics/ads, some widgets) may break if they depend on `eval`/dynamic Function compilation.
---
2) Rule #2: `##+js(aeld, keydown)` — what protection it provides
`aeld` is uBO’s “addEventListener defuser” style scriptlet: it aims to
block registration of event listeners for a given event type via `addEventListener(...)`.
So this targets code that tries to do:
Code:
addEventListener('keydown', handler)
What this can help against
- Basic in-page keylogging or keystroke monitoring that hooks `keydown` broadly.
- Some annoyance/lock-in scripts (disabling hotkeys, intercepting key combos, blocking copy/inspect shortcuts, etc.).
Important limitations (common bypasses)
- It does not necessarily block handlers attached via `onkeydown = ...` or HTML attributes like `onkeydown="..."` (depending on how a page is written).
- Attackers (or sites) can use other events: `keyup`, `keypress`, `input`, `beforeinput`, etc.
- It only affects what goes through `addEventListener`; code can listen in other ways.
Usability impact
It can break legitimate keyboard functionality (site shortcuts, web apps/editors, games, accessibility features, search boxes with special key handling, etc.).
---
3) Rule #3: `##+js(aeld, submit)` — what protection it provides
This blocks registration of `submit` event listeners via `addEventListener('submit', ...)`.
What this can help against
- Form interception/hijacking patterns where scripts hook the submit event to read/modify data right before sending.
- Some malicious/annoying behaviors like forced validation loops, “are you sure” traps, or submit-time rewriting (though many sites do this for legitimate validation).
Important limitations
- It does not necessarily block `onsubmit=` attribute/property handlers.
- It doesn’t stop “submit-like” flows implemented via button `click` handlers, AJAX fetch calls, or direct `form.submit()` calls.
- It won’t prevent credential theft if the page is already fully malicious (it can simply send data without relying on a submit handler).
Usability impact
It can break normal logins/checkout flows, client-side validation, SPA navigation tied to form submits, and some SSO pages.
---
Bottom line
Your three rules mainly provide
anti-obfuscation (`noeval`) and
event-hook suppression (`aeld` for `keydown`/`submit`) on a very broad set of sites (everything not ending in those TLDs). That can reduce exposure to certain sloppy/malicious scripts and some DOM-based abuse, but it’s
not a reliable “security layer” by itself, and it will predictably cause functional breakage on many legitimate sites that rely on those events.
If you want, I can also map these to common “DOM exploit” scenarios (DOM XSS, `postMessage` abuse, formjacking) and where these rules help vs. don’t help—without guessing about any specific site’s safety.