Fixed: [Chromium] extraHeaders permission for sanitization (#442)

This commit is contained in:
nobody 2021-05-04 06:06:38 +02:00
parent 139b933e4a
commit e0a36874fc
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
4 changed files with 18 additions and 6 deletions

View File

@ -26,6 +26,7 @@
"CDNs": true,
"IgnoredHost": true,
"EncodingTypes": true,
"ExtraInfoSpec": true,
"fileGuard": true,
"files": true,

View File

@ -117,7 +117,8 @@ const WebRequest = {
'GET': 'GET',
'BLOCKING': 'blocking',
'HEADERS': 'requestHeaders',
'RESPONSE_HEADERS': 'responseHeaders'
'RESPONSE_HEADERS': 'responseHeaders',
'EXTRA_HEADERS': 'extraHeaders'
};
const WebRequestType = {

View File

@ -21,26 +21,36 @@
var requestSanitizer = {};
/**
* Preparation
* https://codeberg.org/nobody/LocalCDN/issues/442
*/
/* eslint-disable indent */
const ExtraInfoSpec = BrowserType.FIREFOX
? [WebRequest.BLOCKING, WebRequest.HEADERS]
: [WebRequest.BLOCKING, WebRequest.HEADERS, WebRequest.EXTRA_HEADERS];
/* eslint-enable indent */
/**
* Public Methods
*/
requestSanitizer.enable = function () {
let onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
onBeforeSendHeaders.addListener(requestSanitizer._stripMetadata, {
'urls': stateManager.validHosts
}, [WebRequest.BLOCKING, WebRequest.HEADERS]);
}, ExtraInfoSpec);
};
requestSanitizer.disable = function () {
let onBeforeSendHeaders = chrome.webRequest.onBeforeSendHeaders;
onBeforeSendHeaders.removeListener(requestSanitizer._stripMetadata, {
'urls': stateManager.validHosts
}, [WebRequest.BLOCKING, WebRequest.HEADERS]);
}, ExtraInfoSpec);
};
@ -78,7 +88,6 @@ requestSanitizer._stripMetadata = function (requestDetails) {
*/
storageManager.type.get({[Setting.STRIP_METADATA]: true}, function (items) {
if (items === null || items.stripMetadata !== false) {
requestSanitizer.enable();
}

View File

@ -45,6 +45,7 @@
<li>Improved: HTML filter inside frames (<a href="https://codeberg.org/nobody/LocalCDN/issues/439">#439</a>)</li>
<li>Added: leaflet.featuregroup.subgroup v1.0.2 (<a href="https://codeberg.org/nobody/LocalCDN/issues/440">#440</a>)</li>
<li>Added: Leaflet.EasyButton v2.4.0 (<a href="https://codeberg.org/nobody/LocalCDN/issues/441">#441</a>)</li>
<li>Fixed: [Chromium] extraHeaders permission for sanitization (<a href="https://codeberg.org/nobody/LocalCDN/issues/442">#442</a>)</li>
</ul>
<div id="generator-section">
<div class="topic-label">