added trusted-prevent-dom-bypass

D4niloMR 2024-12-06 13:15:31 -03:00
parent 17cda9465c
commit cfe1b1cde0

@ -25,6 +25,7 @@
- [trusted-set-constant](#trusted-set-constantjs-) _(trusted-set)_ [Trusted]
- [trusted-suppress-native-method](#trusted-suppress-native-methodjs-) [Trusted]
- [trusted-override-element-method](#trusted-override-element-methodjs-) [Trusted]
- [trusted-prevent-dom-bypass](#trusted-prevent-dom-bypassjs-) [Trusted]
- [set-cookie](#set-cookiejs-)
- [trusted-set-cookie](#trusted-set-cookiejs-) [Trusted]
- [remove-cookie](#remove-cookiejs-) _(cookie-remover)_
@ -419,7 +420,7 @@ Parameters:
Examples:
- `there.to##+js(disable-newtab-links)`
To prevent new tabs/windows by specifying the location URL, see: [`window-close-if.js`](https://github.com/uBlockOrigin/uBlock-issues/wiki/Resources-Library#window-close-ifjs-)
To prevent new tabs/windows by specifying the location URL, see: [`window-close-if.js`](https://github.com/uBlockOrigin/uBlock-issues/wiki/Resources-Library#window-close-ifjs)
Also see:
- [AdGuard `disable-newtab-links`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#disable-newtab-links)
@ -974,7 +975,7 @@ Also see:
New in [1.38.0](https://github.com/gorhill/uBlock/commit/745fbd1c02b7179052ba97f51c54f7cb000636f0).
Defuses [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest) network requests by returning empty response. Based on [`no-fetch-if.js`](#no-fetch-ifjs-).
Defuses [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest) network requests by returning empty response. Based on [`no-fetch-if.js`](#no-fetch-ifjs).
Parameters:
- optional, space-separated list of conditions which must be ALL fulfilled in order for the defusing to take place:
@ -1011,7 +1012,7 @@ Also see:
New in [1.60.1b3](https://github.com/gorhill/uBlock/commit/fe49ced2ac937a8556a19cb61f4c2cb05ab3c54c)
Essentially the same as [`no-xhr-if`](#no-xhr-ifjs-) except that if the `directive` argument is not a known token, it will be used as is as the response text of the xhr request, whereas `prevent-xhr` returns an empty string when the directive is unknown.
Essentially the same as [`no-xhr-if`](#no-xhr-ifjs) except that if the `directive` argument is not a known token, it will be used as is as the response text of the xhr request, whereas `prevent-xhr` returns an empty string when the directive is unknown.
Examples:
```adblock
@ -1507,7 +1508,6 @@ example.org##+js(trusted-suppress-native-method, sessionStorage.setItem, ' |"ite
Also see:
- [AdGuard `trusted-suppress-native-method`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-suppress-native-method)
***
### trusted-override-element-method.js [](https://github.com/gorhill/uBlock/blob/947602d4fe46ec832d3f95ee3a65633fc4113f44/assets/resources/scriptlets.js#L4267)
@ -1534,6 +1534,31 @@ streamsilk.com##+js(trusted-override-element-method, HTMLAnchorElement.prototype
***
### trusted-prevent-dom-bypass.js [](https://github.com/gorhill/uBlock/blob/36db7f83274ae219d68e24d4aa477c007050e951/src/js/resources/scriptlets.js#L3568)
#### _Trusted scriptlet_
New in [1.60.1b4](https://github.com/gorhill/uBlock/commit/1abc8647425752960f6778fc451bd2a07cb3d3a6)
Prevent the bypassing of uBO scriptlets through anonymous embedded context.
Ensure that a target method in the embedded context is using the corresponding parent context's method (which is assumed to be properly patched), or to replace the embedded context with that of the parent context.
Root issue:
https://issues.chromium.org/issues/40202434
Parameters:
- required, methodPath: The method which calls must be intercepted. The arguments of the intercepted calls are assumed to be HTMLElement, anything else will be ignored.
- optional, targetProp: The method in the embedded context which should be delegated to the parent context. If no method is specified, the embedded context becomes the parent one, i.e. all properties of the embedded context will be that of the parent context.
Examples:
- `##+js(trusted-prevent-dom-bypass, Element.prototype.append, open)`
- `##+js(trusted-prevent-dom-bypass, Element.prototype.appendChild, XMLHttpRequest)`
***
### set-cookie.js [](https://github.com/gorhill/uBlock/blob/4649ae4d78fa7d46e80d71d39d377d1b65309020/assets/resources/scriptlets.js#L2908)
New in [1.50.1b0](https://github.com/gorhill/uBlock/commit/27a54c084556f657522b06484d2e28b21e1fac5a).