WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
253696
declarativeNetRequest modifyHeaders doesn't work for fetch requests initiated from the same Safari extension
https://bugs.webkit.org/show_bug.cgi?id=253696
Summary
declarativeNetRequest modifyHeaders doesn't work for fetch requests initiated...
vsr4493
Reported
2023-03-10 02:07:29 PST
ModifyHeaders in declarativeNetRequest does not work for fetch requests from the extension. This might be since the extension does not have permission over the safari-extension://GUID/ origin which is reset on every browser launch. Expected behaviour: The extension should have permissions for its own origin by default and should be able to modify headers for requests initiated from its own background page. As such adding a rule like this should work: browser.declarativeNetRequest.updateDynamicRules({ addRules: [{ "id": 1, "priority": 1, "action": { "type": "modifyHeaders", "requestHeaders": [{"header": "origin", "operation": "set", "value": "
https://www.bar.com
"}] }, "condition": { "urlFilter": "
http://foo.com
", // Any URL that the extension has permissions for "resourceTypes": ["main_frame", "xmlhttprequest"] } }], }) Current behaviour: The rule currently does not work
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-03-17 03:08:14 PDT
<
rdar://problem/106851279
>
vsr4493
Comment 2
2023-05-22 07:09:14 PDT
Bump! Summary: Consider allowing header modification (specifically the origin) using declarativeNetRequest modifyHeaders for fetch requests made by the extension.
Karl Dubost
Comment 3
2023-11-06 19:02:04 PST
Thanks for the report, probably a duplicate of *** This bug has been marked as a duplicate of
bug 246493
***
Karl Dubost
Comment 4
2023-11-06 19:49:21 PST
***
Bug 263818
has been marked as a duplicate of this bug. ***
Karl Dubost
Comment 5
2023-11-06 19:51:10 PST
I'm changing the resolution as declarativeNetRequest has been released but some of its features are not implemented.
Nicholas Lim
Comment 6
2023-11-13 06:16:29 PST
Hi, may I know if there is a tracker for progress on the declarativeNetRequest API? Thanks!
Gabriel Aubut-Lussier
Comment 7
2024-02-13 13:30:19 PST
I would like to add that websocket connections are also affected by this current limitation. Assuming the resourceTypes also include "websocket", I would expect a `new WebSocket("wss://example.com");` to match against the rule and be modified accordingly.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug