Bug 297838
| Summary: | dNR: fails to match separator `^` to end of URL in `urlFilter` | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | rhill |
| Component: | WebKit Extensions | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | dotproto, timothy, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Mac (Apple Silicon) | ||
| OS: | macOS 15 | ||
rhill
The official DNR documentation[1] (my emphasis):
> '^' : Separator character: This matches anything except a letter, a digit, or one of the following: _, -, ., or %. **This also match the end of the URL.**
For instance the following filter should visually break the web site `https://arstechnica.com/`:
{
"action": {
"type": "block"
},
"condition": {
"resourceTypes": [
"stylesheet"
],
"urlFilter": "arstechnica.net/wp-content/themes/*.css^"
},
"id": 5
}
However the stylesheets are not blocked as expected, the following network request is not blocked by the above rule:
https://cdn.arstechnica.net/wp-content/themes/ars-v9/public/css/app.6e4698.css
The source code comment[2] appears to support that the conversion process does not take into account that `^` should also match end of URL:
> // '^' : Separator character: This matches anything except a letter, a digit or one of the following: _ - . %.
Note: the above issue can be easily reproduce in the extension uBlock Origin Lite, in which it is possible to directly enter DNR rules after enabling "Develop" option in its dashboard, which will make available a "Custom DNR rules" editor in which the above rule can be copy/pasted.
---
[1] https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#type-RuleCondition
[2] https://github.com/WebKit/WebKit/blob/c9ff2b60570e45499e67a9cf5d72a7b567850a1f/Source/WebKit/UIProcess/Extensions/Cocoa/_WKWebExtensionDeclarativeNetRequestRule.mm#L1166
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/159049652>
Simeon Vincent
I'm interested in working on this issue. I am currently setting up my local development environment for WebKit.
Simeon Vincent
Pull request: https://github.com/WebKit/WebKit/pull/56662