-
Notifications
You must be signed in to change notification settings - Fork 56
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
Inconsistency: DNR modifyHeaders
supported headers
#372
Comments
While on the subject, there are additional considerations:
|
No, unfortunately Chrome and Firefox do have some limitations, these limitations are just not documented. There is a list somewhere in source code of both projects,but I couldn't find it in a quick glance. Please note that different context may have different forbidden header names, e.g., https://bugs.chromium.org/p/chromium/issues/detail?id=595993 |
Thanks, I updated the issue description to add that context. |
I had added more context in a comment on crbug "Issue 1117475: DNR rules which add new headers are accepted inconsistently"
While this is not documented in Chrome's DNR docs, I did document the inconsistency on MDN at: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#header_limits |
Safari is planning to add |
follow-up: safari
Firefox 113+ supports DNR without restrictions other than the Host request header: specifying a new value requires host permissions for the new host value (documented at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ModifyHeaderInfo#header_limits ). In particular, DNR extensions in Firefox can specify Sec- headers. While not documented, usual restrictions from (request/response) headers apply. E.g. some headers don't permit multiple values, and an attempt to specify multiple results in unspecified behavior. E.g. appending |
From the Chrome side, using a blocklist instead of an allowlist is intentional. We heard strong developer feedback that there were use cases where developers needed to add or modify custom headers, which could never be reasonably contained in an allowlist. While, in principle, we acknowledge that allowlists are preferable, we felt this was an important use case to support. |
@xeenon, my understanding is that the implementation in Safari was based on the original behaviour in Chrome (which has now changed). Given that Chrome uses a deny list, would you be open to aligning? |
In this case, we are using supportive/implemented to mean using a deny list for header names. |
Yeah, a deny list makes more sense to me. |
In case someone stumbles upon it, this is Safari's allow list |
The DNR
modifyHeaders
rule action allows for request headers to be added, removed or modified. The current Chrome docs do not specify any limitation on which headers these rules can modify.In fact, in Chrome and Firefox arbitrary header names are supported (apart from a list of forbidden header names) and can be modified by these rules. However, in Safari, only 'recognized' headers can specified in these rules. For example, take the following rule:
This rule is accepted and works as expected in Firefox and Chrome. However, in Safari, the following exception is thrown:
This issue has also been submitted to Safari as Radar #FB12074761
The text was updated successfully, but these errors were encountered: