-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for removal of response headers
The syntax to remove response header is a special case of HTML filtering, whereas the response headers are targeted, rather than the response body: example.com##^responseheader(header-name) Where `header-name` is the name of the header to remove, and must always be lowercase. The removal of response headers can only be applied to document resources, i.e. main- or sub-frames. Only a limited set of headers can be targeted for removal: location refresh report-to set-cookie This limitation is to ensure that uBO never lowers the security profile of web pages, i.e. we wouldn't want to remove `content-security-policy`. Given that the header removal occurs at onHeaderReceived time, this new ability works for all browsers. The motivation for this new filtering ability is instance of website using a `refresh` header to redirect a visitor to an undesirable destination after a few seconds.
- Loading branch information
Showing
13 changed files
with
201 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f876b68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gorhill,
We'd like to support this functionality as well, but I've got some questions about the current implementation.
First of all, why limiting it that much and making it a "cosmetic-like" option? I mean I've got it, currently, it's just a measure against "refresh", but there are actually more use-cases and I am pretty sure there will be cases that will require a more fine-grained matching.
What do you think about changing it to a basic rule modifier? Something like
||example.com^$removeresheader=location
?f876b68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the "static extended" category (hostname-based), of which "cosmetic" is a subset. "Static extended" (hostname-based) is for filter syntax beyond "static network" (pattern-based), subsets of which are "cosmetic", "scriptlet injection", "HTML filtering".
Many reasons for this choice:
*$removeheader=refresh,domain=...
, which means no real gain from static extended-based filtering