зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1266235 - Use blocklist prefix in preference names. r=MattN
MozReview-Commit-ID: 5aeoiSEMwYw --HG-- extra : rebase_source : ff4e77c88de58923afe75be2046dcdb98e40ad2f
This commit is contained in:
Родитель
fe3e7d0c4d
Коммит
695a9942a4
|
@ -28,7 +28,7 @@
|
|||
"extensions.blocklist.url": "http://localhost/extensions-dummy/blocklistURL",
|
||||
"extensions.webservice.discoverURL": "http://localhost/extensions-dummy/discoveryURL",
|
||||
"extensions.getAddons.maxResults": 0,
|
||||
"services.kinto.base": "http://localhost/dummy-kinto/v1",
|
||||
"services.blocklist.base": "http://localhost/dummy-kinto/v1",
|
||||
"geo.wifi.uri": "http://localhost/location-dummy/locationURL",
|
||||
"browser.search.geoip.url": "http://localhost/location-dummy/locationURL",
|
||||
"browser.search.isUS": true,
|
||||
|
|
|
@ -62,24 +62,24 @@ pref("extensions.blocklist.url", "https://blocklist.addons.mozilla.org/blocklist
|
|||
pref("extensions.blocklist.detailsURL", "https://www.mozilla.org/%LOCALE%/blocklist/");
|
||||
pref("extensions.blocklist.itemURL", "https://blocklist.addons.mozilla.org/%LOCALE%/%APP%/blocked/%blockID%");
|
||||
|
||||
// Kinto blocklist preferences
|
||||
pref("services.kinto.base", "https://firefox.settings.services.mozilla.com/v1");
|
||||
pref("services.kinto.changes.path", "/buckets/monitor/collections/changes/records");
|
||||
pref("services.kinto.bucket", "blocklists");
|
||||
pref("services.kinto.onecrl.collection", "certificates");
|
||||
pref("services.kinto.onecrl.checked", 0);
|
||||
pref("services.kinto.addons.collection", "addons");
|
||||
pref("services.kinto.addons.checked", 0);
|
||||
pref("services.kinto.plugins.collection", "plugins");
|
||||
pref("services.kinto.plugins.checked", 0);
|
||||
pref("services.kinto.gfx.collection", "gfx");
|
||||
pref("services.kinto.gfx.checked", 0);
|
||||
// Blocklist preferences
|
||||
pref("services.settings.server", "https://firefox.settings.services.mozilla.com/v1");
|
||||
pref("services.blocklist.changes.path", "/buckets/monitor/collections/changes/records");
|
||||
pref("services.blocklist.bucket", "blocklists");
|
||||
pref("services.blocklist.onecrl.collection", "certificates");
|
||||
pref("services.blocklist.onecrl.checked", 0);
|
||||
pref("services.blocklist.addons.collection", "addons");
|
||||
pref("services.blocklist.addons.checked", 0);
|
||||
pref("services.blocklist.plugins.collection", "plugins");
|
||||
pref("services.blocklist.plugins.checked", 0);
|
||||
pref("services.blocklist.gfx.collection", "gfx");
|
||||
pref("services.blocklist.gfx.checked", 0);
|
||||
|
||||
// for now, let's keep kinto update out of the release channel
|
||||
#ifdef RELEASE_BUILD
|
||||
pref("services.kinto.update_enabled", false);
|
||||
pref("services.blocklist.update_enabled", false);
|
||||
#else
|
||||
pref("services.kinto.update_enabled", true);
|
||||
pref("services.blocklist.update_enabled", true);
|
||||
#endif
|
||||
|
||||
pref("extensions.update.autoUpdateDefault", true);
|
||||
|
|
|
@ -231,7 +231,7 @@ const SEC_ERROR_OCSP_FUTURE_RESPONSE = SEC_ERROR_BASE + 131;
|
|||
const SEC_ERROR_OCSP_OLD_RESPONSE = SEC_ERROR_BASE + 132;
|
||||
const MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE = MOZILLA_PKIX_ERROR_BASE + 5;
|
||||
|
||||
const PREF_KINTO_CLOCK_SKEW_SECONDS = "services.kinto.clock_skew_seconds";
|
||||
const PREF_BLOCKLIST_CLOCK_SKEW_SECONDS = "services.blocklist.clock_skew_seconds";
|
||||
|
||||
const PREF_SSL_IMPACT_ROOTS = ["security.tls.version.min", "security.tls.version.max", "security.ssl3."];
|
||||
|
||||
|
@ -280,16 +280,16 @@ var AboutNetAndCertErrorListener = {
|
|||
break;
|
||||
|
||||
// in case the certificate expired we make sure the system clock
|
||||
// matches kinto server time
|
||||
// matches settings server (kinto) time
|
||||
case SEC_ERROR_EXPIRED_CERTIFICATE:
|
||||
case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
|
||||
case SEC_ERROR_OCSP_FUTURE_RESPONSE:
|
||||
case SEC_ERROR_OCSP_OLD_RESPONSE:
|
||||
case MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE:
|
||||
|
||||
// use Kinto stats if available
|
||||
if (Services.prefs.getPrefType(PREF_KINTO_CLOCK_SKEW_SECONDS)) {
|
||||
let difference = Services.prefs.getIntPref(PREF_KINTO_CLOCK_SKEW_SECONDS);
|
||||
// use blocklist stats if available
|
||||
if (Services.prefs.getPrefType(PREF_BLOCKLIST_CLOCK_SKEW_SECONDS)) {
|
||||
let difference = Services.prefs.getIntPref(PREF_BLOCKLIST_CLOCK_SKEW_SECONDS);
|
||||
|
||||
// if the difference is more than a day
|
||||
if (Math.abs(difference) > 60 * 60 * 24) {
|
||||
|
|
|
@ -105,7 +105,7 @@ add_task(function* checkBadStsCert() {
|
|||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
const PREF_KINTO_CLOCK_SKEW_SECONDS = "services.kinto.clock_skew_seconds";
|
||||
const PREF_BLOCKLIST_CLOCK_SKEW_SECONDS = "services.blocklist.clock_skew_seconds";
|
||||
|
||||
add_task(function* checkWrongSystemTimeWarning() {
|
||||
function* setUpPage() {
|
||||
|
@ -144,7 +144,7 @@ add_task(function* checkWrongSystemTimeWarning() {
|
|||
|
||||
let skew = Math.floor((Date.now() - serverDate.getTime()) / 1000);
|
||||
yield new Promise(r => SpecialPowers.pushPrefEnv({set:
|
||||
[[PREF_KINTO_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
[[PREF_BLOCKLIST_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
|
||||
info("Loading a bad cert page with a skewed clock");
|
||||
let message = yield Task.spawn(setUpPage);
|
||||
|
@ -165,7 +165,7 @@ add_task(function* checkWrongSystemTimeWarning() {
|
|||
|
||||
skew = Math.floor((Date.now() - serverDate.getTime()) / 1000);
|
||||
yield new Promise(r => SpecialPowers.pushPrefEnv({set:
|
||||
[[PREF_KINTO_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
[[PREF_BLOCKLIST_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
|
||||
info("Loading a bad cert page with a skewed clock");
|
||||
message = yield Task.spawn(setUpPage);
|
||||
|
@ -182,7 +182,7 @@ add_task(function* checkWrongSystemTimeWarning() {
|
|||
// pretend we only have a slightly skewed system time, four hours
|
||||
skew = 60 * 60 * 4;
|
||||
yield new Promise(r => SpecialPowers.pushPrefEnv({set:
|
||||
[[PREF_KINTO_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
[[PREF_BLOCKLIST_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
|
||||
info("Loading a bad cert page with an only slightly skewed clock");
|
||||
message = yield Task.spawn(setUpPage);
|
||||
|
@ -194,7 +194,7 @@ add_task(function* checkWrongSystemTimeWarning() {
|
|||
// now pretend we have no skewed system time
|
||||
skew = 0;
|
||||
yield new Promise(r => SpecialPowers.pushPrefEnv({set:
|
||||
[[PREF_KINTO_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
[[PREF_BLOCKLIST_CLOCK_SKEW_SECONDS, skew]]}, r));
|
||||
|
||||
info("Loading a bad cert page with no skewed clock");
|
||||
message = yield Task.spawn(setUpPage);
|
||||
|
|
|
@ -244,25 +244,25 @@ pref("extensions.blocklist.interval", 86400);
|
|||
pref("extensions.blocklist.url", "https://blocklist.addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
|
||||
pref("extensions.blocklist.detailsURL", "https://www.mozilla.com/%LOCALE%/blocklist/");
|
||||
|
||||
// Kinto blocklist preferences
|
||||
pref("services.kinto.base", "https://firefox.settings.services.mozilla.com/v1");
|
||||
pref("services.kinto.changes.path", "/buckets/monitor/collections/changes/records");
|
||||
pref("services.kinto.bucket", "blocklists");
|
||||
pref("services.kinto.onecrl.collection", "certificates");
|
||||
pref("services.kinto.onecrl.checked", 0);
|
||||
pref("services.kinto.addons.collection", "addons");
|
||||
pref("services.kinto.addons.checked", 0);
|
||||
pref("services.kinto.plugins.collection", "plugins");
|
||||
pref("services.kinto.plugins.checked", 0);
|
||||
pref("services.kinto.gfx.collection", "gfx");
|
||||
pref("services.kinto.gfx.checked", 0);
|
||||
// Blocklist preferences
|
||||
pref("services.settings.server", "https://firefox.settings.services.mozilla.com/v1");
|
||||
pref("services.blocklist.changes.path", "/buckets/monitor/collections/changes/records");
|
||||
pref("services.blocklist.bucket", "blocklists");
|
||||
pref("services.blocklist.onecrl.collection", "certificates");
|
||||
pref("services.blocklist.onecrl.checked", 0);
|
||||
pref("services.blocklist.addons.collection", "addons");
|
||||
pref("services.blocklist.addons.checked", 0);
|
||||
pref("services.blocklist.plugins.collection", "plugins");
|
||||
pref("services.blocklist.plugins.checked", 0);
|
||||
pref("services.blocklist.gfx.collection", "gfx");
|
||||
pref("services.blocklist.gfx.checked", 0);
|
||||
|
||||
// for now, let's keep kinto update out of the release channel (pending
|
||||
// collection signatures)
|
||||
#ifdef RELEASE_BUILD
|
||||
pref("services.kinto.update_enabled", false);
|
||||
pref("services.blocklist.update_enabled", false);
|
||||
#else
|
||||
pref("services.kinto.update_enabled", true);
|
||||
pref("services.blocklist.update_enabled", true);
|
||||
#endif
|
||||
|
||||
/* Don't let XPIProvider install distribution add-ons; we do our own thing on mobile. */
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace mozilla;
|
|||
using namespace mozilla::pkix;
|
||||
|
||||
#define PREF_BACKGROUND_UPDATE_TIMER "app.update.lastUpdateTime.blocklist-background-update-timer"
|
||||
#define PREF_KINTO_ONECRL_CHECKED "services.kinto.onecrl.checked"
|
||||
#define PREF_BLOCKLIST_ONECRL_CHECKED "services.blocklist.onecrl.checked"
|
||||
#define PREF_MAX_STALENESS_IN_SECONDS "security.onecrl.maximum_staleness_in_seconds"
|
||||
#define PREF_ONECRL_VIA_AMO "security.onecrl.via.amo"
|
||||
|
||||
|
@ -146,7 +146,7 @@ CertBlocklist::~CertBlocklist()
|
|||
PREF_ONECRL_VIA_AMO,
|
||||
this);
|
||||
Preferences::UnregisterCallback(CertBlocklist::PreferenceChanged,
|
||||
PREF_KINTO_ONECRL_CHECKED,
|
||||
PREF_BLOCKLIST_ONECRL_CHECKED,
|
||||
this);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ CertBlocklist::Init()
|
|||
return rv;
|
||||
}
|
||||
rv = Preferences::RegisterCallbackAndCall(CertBlocklist::PreferenceChanged,
|
||||
PREF_KINTO_ONECRL_CHECKED,
|
||||
PREF_BLOCKLIST_ONECRL_CHECKED,
|
||||
this);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
@ -659,8 +659,8 @@ CertBlocklist::PreferenceChanged(const char* aPref, void* aClosure)
|
|||
if (strcmp(aPref, PREF_BACKGROUND_UPDATE_TIMER) == 0) {
|
||||
sLastBlocklistUpdate = Preferences::GetUint(PREF_BACKGROUND_UPDATE_TIMER,
|
||||
uint32_t(0));
|
||||
} else if (strcmp(aPref, PREF_KINTO_ONECRL_CHECKED) == 0) {
|
||||
sLastKintoUpdate = Preferences::GetUint(PREF_KINTO_ONECRL_CHECKED,
|
||||
} else if (strcmp(aPref, PREF_BLOCKLIST_ONECRL_CHECKED) == 0) {
|
||||
sLastKintoUpdate = Preferences::GetUint(PREF_BLOCKLIST_ONECRL_CHECKED,
|
||||
uint32_t(0));
|
||||
} else if (strcmp(aPref, PREF_MAX_STALENESS_IN_SECONDS) == 0) {
|
||||
sMaxStaleness = Preferences::GetUint(PREF_MAX_STALENESS_IN_SECONDS,
|
||||
|
|
|
@ -47,7 +47,7 @@ var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
|||
stream.write(data, data.length);
|
||||
stream.close();
|
||||
|
||||
const PREF_KINTO_UPDATE_ENABLED = "services.kinto.update_enabled";
|
||||
const PREF_BLOCKLIST_UPDATE_ENABLED = "services.blocklist.update_enabled";
|
||||
const PREF_ONECRL_VIA_AMO = "security.onecrl.via.amo";
|
||||
|
||||
var revocations = profile.clone();
|
||||
|
@ -225,7 +225,7 @@ function run_test() {
|
|||
" c2VyaWFsMi4=";
|
||||
|
||||
// This test assumes OneCRL updates via AMO
|
||||
Services.prefs.setBoolPref(PREF_KINTO_UPDATE_ENABLED, false);
|
||||
Services.prefs.setBoolPref(PREF_BLOCKLIST_UPDATE_ENABLED, false);
|
||||
Services.prefs.setBoolPref(PREF_ONECRL_VIA_AMO, true);
|
||||
|
||||
add_test(function () {
|
||||
|
|
|
@ -149,7 +149,7 @@ function run_test() {
|
|||
// enable OneCRL OCSP skipping - allow staleness of up to 30 hours
|
||||
Services.prefs.setIntPref("security.onecrl.maximum_staleness_in_seconds", 108000);
|
||||
// set the blocklist-background-update-timer value to the recent past
|
||||
Services.prefs.setIntPref("services.kinto.onecrl.checked",
|
||||
Services.prefs.setIntPref("services.blocklist.onecrl.checked",
|
||||
Math.floor(Date.now() / 1000) - 1);
|
||||
Services.prefs.setIntPref("app.update.lastUpdateTime.blocklist-background-update-timer",
|
||||
Math.floor(Date.now() / 1000) - 1);
|
||||
|
@ -177,7 +177,7 @@ function run_test() {
|
|||
// enable OneCRL OCSP skipping - allow staleness of up to 30 hours
|
||||
Services.prefs.setIntPref("security.onecrl.maximum_staleness_in_seconds", 108000);
|
||||
// set the blocklist-background-update-timer value to the more distant past
|
||||
Services.prefs.setIntPref("services.kinto.onecrl.checked",
|
||||
Services.prefs.setIntPref("services.blocklist.onecrl.checked",
|
||||
Math.floor(Date.now() / 1000) - 108080);
|
||||
Services.prefs.setIntPref("app.update.lastUpdateTime.blocklist-background-update-timer",
|
||||
Math.floor(Date.now() / 1000) - 108080);
|
||||
|
@ -192,13 +192,13 @@ function run_test() {
|
|||
|
||||
add_test(function () {
|
||||
// test that setting "security.onecrl.via.amo" results in the correct
|
||||
// OCSP behavior when services.kinto.onecrl.checked is in the distant past
|
||||
// OCSP behavior when services.blocklist.onecrl.checked is in the distant past
|
||||
// and blacklist-background-update-timer is recent
|
||||
Services.prefs.setBoolPref("security.onecrl.via.amo", false);
|
||||
// enable OneCRL OCSP skipping - allow staleness of up to 30 hours
|
||||
Services.prefs.setIntPref("security.onecrl.maximum_staleness_in_seconds", 108000);
|
||||
// set the blocklist-background-update-timer value to the recent past
|
||||
// (services.kinto.onecrl.checked defaults to 0)
|
||||
// (services.blocklist.onecrl.checked defaults to 0)
|
||||
Services.prefs.setIntPref("app.update.lastUpdateTime.blocklist-background-update-timer",
|
||||
Math.floor(Date.now() / 1000) - 1);
|
||||
clearOCSPCache();
|
||||
|
@ -212,14 +212,14 @@ function run_test() {
|
|||
|
||||
add_test(function () {
|
||||
// test that setting "security.onecrl.via.amo" results in the correct
|
||||
// OCSP behavior when services.kinto.onecrl.checked is recent
|
||||
// OCSP behavior when services.blocklist.onecrl.checked is recent
|
||||
Services.prefs.setBoolPref("security.onecrl.via.amo", false);
|
||||
|
||||
// enable OneCRL OCSP skipping - allow staleness of up to 30 hours
|
||||
Services.prefs.setIntPref("security.onecrl.maximum_staleness_in_seconds", 108000);
|
||||
|
||||
// now set services.kinto.onecrl.checked to a recent value
|
||||
Services.prefs.setIntPref("services.kinto.onecrl.checked",
|
||||
// now set services.blocklist.onecrl.checked to a recent value
|
||||
Services.prefs.setIntPref("services.blocklist.onecrl.checked",
|
||||
Math.floor(Date.now() / 1000) - 1);
|
||||
|
||||
clearOCSPCache();
|
||||
|
@ -229,7 +229,7 @@ function run_test() {
|
|||
// The tests following this assume no OCSP bypass
|
||||
Services.prefs.setIntPref("security.onecrl.maximum_staleness_in_seconds", 0);
|
||||
Services.prefs.clearUserPref("security.onecrl.via.amo");
|
||||
Services.prefs.clearUserPref("services.kinto.onecrl.checked");
|
||||
Services.prefs.clearUserPref("services.blocklist.onecrl.checked");
|
||||
ocspResponder.stop(run_next_test);
|
||||
});
|
||||
|
||||
|
|
|
@ -20,16 +20,16 @@ const { OS } = Cu.import("resource://gre/modules/osfile.jsm");
|
|||
|
||||
const { loadKinto } = Cu.import("resource://services-common/kinto-offline-client.js");
|
||||
|
||||
const PREF_KINTO_BASE = "services.kinto.base";
|
||||
const PREF_KINTO_BUCKET = "services.kinto.bucket";
|
||||
const PREF_KINTO_ONECRL_COLLECTION = "services.kinto.onecrl.collection";
|
||||
const PREF_KINTO_ONECRL_CHECKED_SECONDS = "services.kinto.onecrl.checked";
|
||||
const PREF_KINTO_ADDONS_COLLECTION = "services.kinto.addons.collection";
|
||||
const PREF_KINTO_ADDONS_CHECKED_SECONDS = "services.kinto.addons.checked";
|
||||
const PREF_KINTO_PLUGINS_COLLECTION = "services.kinto.plugins.collection";
|
||||
const PREF_KINTO_PLUGINS_CHECKED_SECONDS = "services.kinto.plugins.checked";
|
||||
const PREF_KINTO_GFX_COLLECTION = "services.kinto.gfx.collection";
|
||||
const PREF_KINTO_GFX_CHECKED_SECONDS = "services.kinto.gfx.checked";
|
||||
const PREF_SETTINGS_SERVER = "services.settings.server";
|
||||
const PREF_BLOCKLIST_BUCKET = "services.blocklist.bucket";
|
||||
const PREF_BLOCKLIST_ONECRL_COLLECTION = "services.blocklist.onecrl.collection";
|
||||
const PREF_BLOCKLIST_ONECRL_CHECKED_SECONDS = "services.blocklist.onecrl.checked";
|
||||
const PREF_BLOCKLIST_ADDONS_COLLECTION = "services.blocklist.addons.collection";
|
||||
const PREF_BLOCKLIST_ADDONS_CHECKED_SECONDS = "services.blocklist.addons.checked";
|
||||
const PREF_BLOCKLIST_PLUGINS_COLLECTION = "services.blocklist.plugins.collection";
|
||||
const PREF_BLOCKLIST_PLUGINS_CHECKED_SECONDS = "services.blocklist.plugins.checked";
|
||||
const PREF_BLOCKLIST_GFX_COLLECTION = "services.blocklist.gfx.collection";
|
||||
const PREF_BLOCKLIST_GFX_CHECKED_SECONDS = "services.blocklist.gfx.checked";
|
||||
|
||||
this.FILENAME_ADDONS_JSON = "blocklist-addons.json";
|
||||
this.FILENAME_GFX_JSON = "blocklist-gfx.json";
|
||||
|
@ -42,8 +42,8 @@ this.FILENAME_PLUGINS_JSON = "blocklist-plugins.json";
|
|||
* persist the local DB.
|
||||
*/
|
||||
function kintoClient() {
|
||||
let base = Services.prefs.getCharPref(PREF_KINTO_BASE);
|
||||
let bucket = Services.prefs.getCharPref(PREF_KINTO_BUCKET);
|
||||
let base = Services.prefs.getCharPref(PREF_SETTINGS_SERVER);
|
||||
let bucket = Services.prefs.getCharPref(PREF_BLOCKLIST_BUCKET);
|
||||
|
||||
let Kinto = loadKinto();
|
||||
|
||||
|
@ -161,25 +161,25 @@ function* updateJSONBlocklist(filename, records) {
|
|||
|
||||
|
||||
this.OneCRLBlocklistClient = new BlocklistClient(
|
||||
Services.prefs.getCharPref(PREF_KINTO_ONECRL_COLLECTION),
|
||||
PREF_KINTO_ONECRL_CHECKED_SECONDS,
|
||||
Services.prefs.getCharPref(PREF_BLOCKLIST_ONECRL_COLLECTION),
|
||||
PREF_BLOCKLIST_ONECRL_CHECKED_SECONDS,
|
||||
updateCertBlocklist
|
||||
);
|
||||
|
||||
this.AddonBlocklistClient = new BlocklistClient(
|
||||
Services.prefs.getCharPref(PREF_KINTO_ADDONS_COLLECTION),
|
||||
PREF_KINTO_ADDONS_CHECKED_SECONDS,
|
||||
Services.prefs.getCharPref(PREF_BLOCKLIST_ADDONS_COLLECTION),
|
||||
PREF_BLOCKLIST_ADDONS_CHECKED_SECONDS,
|
||||
updateJSONBlocklist.bind(undefined, FILENAME_ADDONS_JSON)
|
||||
);
|
||||
|
||||
this.GfxBlocklistClient = new BlocklistClient(
|
||||
Services.prefs.getCharPref(PREF_KINTO_GFX_COLLECTION),
|
||||
PREF_KINTO_GFX_CHECKED_SECONDS,
|
||||
Services.prefs.getCharPref(PREF_BLOCKLIST_GFX_COLLECTION),
|
||||
PREF_BLOCKLIST_GFX_CHECKED_SECONDS,
|
||||
updateJSONBlocklist.bind(undefined, FILENAME_GFX_JSON)
|
||||
);
|
||||
|
||||
this.PluginBlocklistClient = new BlocklistClient(
|
||||
Services.prefs.getCharPref(PREF_KINTO_PLUGINS_COLLECTION),
|
||||
PREF_KINTO_PLUGINS_CHECKED_SECONDS,
|
||||
Services.prefs.getCharPref(PREF_BLOCKLIST_PLUGINS_COLLECTION),
|
||||
PREF_BLOCKLIST_PLUGINS_CHECKED_SECONDS,
|
||||
updateJSONBlocklist.bind(undefined, FILENAME_PLUGINS_JSON)
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["checkVersions", "addTestKintoClient"];
|
||||
this.EXPORTED_SYMBOLS = ["checkVersions", "addTestBlocklistClient"];
|
||||
|
||||
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
|
@ -11,13 +11,12 @@ Cu.import("resource://gre/modules/Task.jsm");
|
|||
Cu.importGlobalProperties(['fetch']);
|
||||
const BlocklistClients = Cu.import("resource://services-common/blocklist-clients.js", {});
|
||||
|
||||
const PREF_KINTO_CHANGES_PATH = "services.kinto.changes.path";
|
||||
const PREF_KINTO_BASE = "services.kinto.base";
|
||||
const PREF_KINTO_BUCKET = "services.kinto.bucket";
|
||||
const PREF_KINTO_LAST_UPDATE = "services.kinto.last_update_seconds";
|
||||
const PREF_KINTO_LAST_ETAG = "services.kinto.last_etag";
|
||||
const PREF_KINTO_CLOCK_SKEW_SECONDS = "services.kinto.clock_skew_seconds";
|
||||
const PREF_KINTO_ONECRL_COLLECTION = "services.kinto.onecrl.collection";
|
||||
const PREF_SETTINGS_SERVER = "services.settings.server";
|
||||
const PREF_BLOCKLIST_CHANGES_PATH = "services.blocklist.changes.path";
|
||||
const PREF_BLOCKLIST_BUCKET = "services.blocklist.bucket";
|
||||
const PREF_BLOCKLIST_LAST_UPDATE = "services.blocklist.last_update_seconds";
|
||||
const PREF_BLOCKLIST_LAST_ETAG = "services.blocklist.last_etag";
|
||||
const PREF_BLOCKLIST_CLOCK_SKEW_SECONDS = "services.blocklist.clock_skew_seconds";
|
||||
|
||||
|
||||
const gBlocklistClients = {
|
||||
|
@ -28,7 +27,7 @@ const gBlocklistClients = {
|
|||
};
|
||||
|
||||
// Add a blocklist client for testing purposes. Do not use for any other purpose
|
||||
this.addTestKintoClient = (name, client) => { gBlocklistClients[name] = client; }
|
||||
this.addTestBlocklistClient = (name, client) => { gBlocklistClients[name] = client; }
|
||||
|
||||
// This is called by the ping mechanism.
|
||||
// returns a promise that rejects if something goes wrong
|
||||
|
@ -43,14 +42,14 @@ this.checkVersions = function() {
|
|||
// "collection":"certificates"
|
||||
// }]}
|
||||
// Right now, we only use the collection name and the last modified info
|
||||
let kintoBase = Services.prefs.getCharPref(PREF_KINTO_BASE);
|
||||
let changesEndpoint = kintoBase + Services.prefs.getCharPref(PREF_KINTO_CHANGES_PATH);
|
||||
let blocklistsBucket = Services.prefs.getCharPref(PREF_KINTO_BUCKET);
|
||||
let kintoBase = Services.prefs.getCharPref(PREF_SETTINGS_SERVER);
|
||||
let changesEndpoint = kintoBase + Services.prefs.getCharPref(PREF_BLOCKLIST_CHANGES_PATH);
|
||||
let blocklistsBucket = Services.prefs.getCharPref(PREF_BLOCKLIST_BUCKET);
|
||||
|
||||
// Use ETag to obtain a `304 Not modified` when no change occurred.
|
||||
const headers = {};
|
||||
if (Services.prefs.prefHasUserValue(PREF_KINTO_LAST_ETAG)) {
|
||||
const lastEtag = Services.prefs.getCharPref(PREF_KINTO_LAST_ETAG);
|
||||
if (Services.prefs.prefHasUserValue(PREF_BLOCKLIST_LAST_ETAG)) {
|
||||
const lastEtag = Services.prefs.getCharPref(PREF_BLOCKLIST_LAST_ETAG);
|
||||
if (lastEtag) {
|
||||
headers["If-None-Match"] = lastEtag;
|
||||
}
|
||||
|
@ -78,8 +77,8 @@ this.checkVersions = function() {
|
|||
// negative clockDifference means local time is behind server time
|
||||
// by the absolute of that value in seconds (positive means it's ahead)
|
||||
let clockDifference = Math.floor((Date.now() - serverTimeMillis) / 1000);
|
||||
Services.prefs.setIntPref(PREF_KINTO_CLOCK_SKEW_SECONDS, clockDifference);
|
||||
Services.prefs.setIntPref(PREF_KINTO_LAST_UPDATE, serverTimeMillis / 1000);
|
||||
Services.prefs.setIntPref(PREF_BLOCKLIST_CLOCK_SKEW_SECONDS, clockDifference);
|
||||
Services.prefs.setIntPref(PREF_BLOCKLIST_LAST_UPDATE, serverTimeMillis / 1000);
|
||||
|
||||
let firstError;
|
||||
for (let collectionInfo of versionInfo.data) {
|
||||
|
@ -112,7 +111,7 @@ this.checkVersions = function() {
|
|||
// Save current Etag for next poll.
|
||||
if (response.headers.has("ETag")) {
|
||||
const currentEtag = response.headers.get("ETag");
|
||||
Services.prefs.setCharPref(PREF_KINTO_LAST_ETAG, currentEtag);
|
||||
Services.prefs.setCharPref(PREF_BLOCKLIST_LAST_ETAG, currentEtag);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ add_task(function* test_something(){
|
|||
const configPath = "/v1/";
|
||||
const recordsPath = "/v1/buckets/blocklists/collections/certificates/records";
|
||||
|
||||
Services.prefs.setCharPref("services.kinto.base",
|
||||
Services.prefs.setCharPref("services.settings.server",
|
||||
`http://localhost:${server.identity.primaryPort}/v1`);
|
||||
|
||||
// register a handler
|
||||
|
@ -93,7 +93,7 @@ add_task(function* test_something(){
|
|||
// Try to maybeSync with the current lastModified value - no connection
|
||||
// should be attempted.
|
||||
// Clear the kinto base pref so any connections will cause a test failure
|
||||
Services.prefs.clearUserPref("services.kinto.base");
|
||||
Services.prefs.clearUserPref("services.settings.server");
|
||||
yield OneCRLBlocklistClient.maybeSync(4000, Date.now());
|
||||
|
||||
// Try again with a lastModified value at some point in the past
|
||||
|
@ -101,9 +101,9 @@ add_task(function* test_something(){
|
|||
|
||||
// Check the OneCRL check time pref is modified, even if the collection
|
||||
// hasn't changed
|
||||
Services.prefs.setIntPref("services.kinto.onecrl.checked", 0);
|
||||
Services.prefs.setIntPref("services.blocklist.onecrl.checked", 0);
|
||||
yield OneCRLBlocklistClient.maybeSync(3000, Date.now());
|
||||
let newValue = Services.prefs.getIntPref("services.kinto.onecrl.checked");
|
||||
let newValue = Services.prefs.getIntPref("services.blocklist.onecrl.checked");
|
||||
do_check_neq(newValue, 0);
|
||||
});
|
||||
|
||||
|
@ -141,7 +141,7 @@ function getSampleResponse(req, port) {
|
|||
"Server: waitress"
|
||||
],
|
||||
"status": {status: 200, statusText: "OK"},
|
||||
"responseBody": JSON.stringify({"settings":{"cliquet.batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
|
||||
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
|
||||
},
|
||||
"GET:/v1/buckets/blocklists/collections/certificates/records?_sort=-last_modified": {
|
||||
"sampleHeaders": [
|
||||
|
|
|
@ -77,7 +77,7 @@ function run_test() {
|
|||
server.start(-1);
|
||||
|
||||
// Point the blocklist clients to use this local HTTP server.
|
||||
Services.prefs.setCharPref("services.kinto.base",
|
||||
Services.prefs.setCharPref("services.settings.server",
|
||||
`http://localhost:${server.identity.primaryPort}/v1`);
|
||||
|
||||
// Setup server fake responses.
|
||||
|
@ -240,7 +240,7 @@ function getSampleResponse(req, port) {
|
|||
"Server: waitress"
|
||||
],
|
||||
"status": {status: 200, statusText: "OK"},
|
||||
"responseBody": JSON.stringify({"settings":{"cliquet.batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
|
||||
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
|
||||
},
|
||||
"GET:/v1/buckets/blocklists/collections/addons/records?_sort=-last_modified": {
|
||||
"sampleHeaders": [
|
||||
|
|
|
@ -2,10 +2,10 @@ Cu.import("resource://testing-common/httpd.js");
|
|||
|
||||
var server;
|
||||
|
||||
const PREF_KINTO_BASE = "services.kinto.base";
|
||||
const PREF_LAST_UPDATE = "services.kinto.last_update_seconds";
|
||||
const PREF_LAST_ETAG = "services.kinto.last_etag";
|
||||
const PREF_CLOCK_SKEW_SECONDS = "services.kinto.clock_skew_seconds";
|
||||
const PREF_SETTINGS_SERVER = "services.settings.server";
|
||||
const PREF_LAST_UPDATE = "services.blocklist.last_update_seconds";
|
||||
const PREF_LAST_ETAG = "services.blocklist.last_etag";
|
||||
const PREF_CLOCK_SKEW_SECONDS = "services.blocklist.clock_skew_seconds";
|
||||
|
||||
// Check to ensure maybeSync is called with correct values when a changes
|
||||
// document contains information on when a collection was last modified
|
||||
|
@ -40,7 +40,7 @@ add_task(function* test_check_maybeSync(){
|
|||
server.registerPathHandler(changesPath, handleResponse.bind(null, 2000));
|
||||
|
||||
// set up prefs so the kinto updater talks to the test server
|
||||
Services.prefs.setCharPref(PREF_KINTO_BASE,
|
||||
Services.prefs.setCharPref(PREF_SETTINGS_SERVER,
|
||||
`http://localhost:${server.identity.primaryPort}/v1`);
|
||||
|
||||
// set some initial values so we can check these are updated appropriately
|
||||
|
@ -56,7 +56,7 @@ add_task(function* test_check_maybeSync(){
|
|||
let syncPromise = new Promise(function(resolve, reject) {
|
||||
// add a test kinto client that will respond to lastModified information
|
||||
// for a collection called 'test-collection'
|
||||
updater.addTestKintoClient("test-collection", {
|
||||
updater.addTestBlocklistClient("test-collection", {
|
||||
maybeSync(lastModified, serverTime) {
|
||||
do_check_eq(lastModified, 1000);
|
||||
do_check_eq(serverTime, 2000);
|
||||
|
@ -85,7 +85,7 @@ add_task(function* test_check_maybeSync(){
|
|||
// Simulate a poll with up-to-date collection.
|
||||
Services.prefs.setIntPref(PREF_LAST_UPDATE, 0);
|
||||
// If server has no change, a 304 is received, maybeSync() is not called.
|
||||
updater.addTestKintoClient("test-collection", {
|
||||
updater.addTestBlocklistClient("test-collection", {
|
||||
maybeSync: () => {throw new Error("Should not be called");}
|
||||
});
|
||||
yield updater.checkVersions();
|
||||
|
|
|
@ -369,7 +369,7 @@ function getSampleResponse(req, port) {
|
|||
"Server: waitress"
|
||||
],
|
||||
"status": {status: 200, statusText: "OK"},
|
||||
"responseBody": JSON.stringify({"settings":{"cliquet.batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
|
||||
"responseBody": JSON.stringify({"settings":{"batch_max_requests":25}, "url":`http://localhost:${port}/v1/`, "documentation":"https://kinto.readthedocs.org/", "version":"1.5.1", "commit":"cbc6f58", "hello":"kinto"})
|
||||
},
|
||||
"GET:/v1/buckets/default/collections/test_collection/records?_sort=-last_modified": {
|
||||
"sampleHeaders": [
|
||||
|
|
|
@ -109,8 +109,8 @@ user_pref("extensions.getAddons.get.url", "http://%(server)s/extensions-dummy/re
|
|||
user_pref("extensions.getAddons.getWithPerformance.url", "http://%(server)s/extensions-dummy/repositoryGetWithPerformanceURL");
|
||||
user_pref("extensions.getAddons.search.browseURL", "http://%(server)s/extensions-dummy/repositoryBrowseURL");
|
||||
user_pref("extensions.getAddons.search.url", "http://%(server)s/extensions-dummy/repositorySearchURL");
|
||||
// Ensure kinto updates don't hit the network
|
||||
user_pref("services.kinto.base", "http://%(server)s/dummy-kinto/v1");
|
||||
// Ensure blocklist updates don't hit the network
|
||||
user_pref("services.settings.server", "http://%(server)s/dummy-kinto/v1");
|
||||
// Make sure that opening the plugins check page won't hit the network
|
||||
user_pref("plugins.update.url", "http://%(server)s/plugins-dummy/updateCheckURL");
|
||||
// Make sure SNTP requests don't hit the network
|
||||
|
|
|
@ -48,7 +48,7 @@ const PREF_BLOCKLIST_PINGCOUNTTOTAL = "extensions.blocklist.pingCountTotal";
|
|||
const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion";
|
||||
const PREF_BLOCKLIST_SUPPRESSUI = "extensions.blocklist.suppressUI";
|
||||
const PREF_ONECRL_VIA_AMO = "security.onecrl.via.amo";
|
||||
const PREF_KINTO_UPDATE_ENABLED = "services.kinto.update_enabled";
|
||||
const PREF_BLOCKLIST_UPDATE_ENABLED = "services.blocklist.update_enabled";
|
||||
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
|
||||
const PREF_GENERAL_USERAGENT_LOCALE = "general.useragent.locale";
|
||||
const PREF_APP_DISTRIBUTION = "distribution.id";
|
||||
|
@ -631,7 +631,7 @@ Blocklist.prototype = {
|
|||
this._loadBlocklist();
|
||||
|
||||
// If kinto update is enabled, do the kinto update
|
||||
if (gPref.getBoolPref(PREF_KINTO_UPDATE_ENABLED)) {
|
||||
if (gPref.getBoolPref(PREF_BLOCKLIST_UPDATE_ENABLED)) {
|
||||
const updater =
|
||||
Components.utils.import("resource://services-common/blocklist-updater.js",
|
||||
{});
|
||||
|
|
|
@ -1874,8 +1874,7 @@ Services.prefs.setBoolPref("extensions.showMismatchUI", false);
|
|||
Services.prefs.setCharPref("extensions.update.url", "http://127.0.0.1/updateURL");
|
||||
Services.prefs.setCharPref("extensions.update.background.url", "http://127.0.0.1/updateBackgroundURL");
|
||||
Services.prefs.setCharPref("extensions.blocklist.url", "http://127.0.0.1/blocklistURL");
|
||||
Services.prefs.setCharPref("services.kinto.base",
|
||||
"http://localhost/dummy-kinto/v1");
|
||||
Services.prefs.setCharPref("services.settings.server", "http://localhost/dummy-kinto/v1");
|
||||
|
||||
// By default ignore bundled add-ons
|
||||
Services.prefs.setBoolPref("extensions.installDistroAddons", false);
|
||||
|
|
|
@ -67,7 +67,7 @@ function load_blocklist(aFile, aCallback) {
|
|||
// if we're not using the blocklist.xml for certificate blocklist state,
|
||||
// ensure that kinto update is enabled
|
||||
if (!Services.prefs.getBoolPref("security.onecrl.via.amo")) {
|
||||
ok(Services.prefs.getBoolPref("services.kinto.update_enabled", false),
|
||||
ok(Services.prefs.getBoolPref("services.blocklist.update_enabled", false),
|
||||
"Kinto update should be enabled");
|
||||
}
|
||||
blocklist.notify(null);
|
||||
|
|
Загрузка…
Ссылка в новой задаче