Skip to content

Commit

Permalink
Bug 1266235 - Use blocklist prefix in preference names. r=MattN
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 5aeoiSEMwYw
  • Loading branch information
leplatrem committed May 19, 2016
1 parent c122a93 commit 09d0e16
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 113 deletions.
2 changes: 1 addition & 1 deletion addon-sdk/source/test/preferences/no-connections.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 14 additions & 14 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions browser/base/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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."];

Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions browser/base/content/test/general/browser_aboutCertError.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
28 changes: 14 additions & 14 deletions mobile/android/app/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
10 changes: 5 additions & 5 deletions security/manager/ssl/CertBlocklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -146,7 +146,7 @@ CertBlocklist::~CertBlocklist()
PREF_ONECRL_VIA_AMO,
this);
Preferences::UnregisterCallback(CertBlocklist::PreferenceChanged,
PREF_KINTO_ONECRL_CHECKED,
PREF_BLOCKLIST_ONECRL_CHECKED,
this);
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions security/manager/ssl/tests/unit/test_cert_blocklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 () {
Expand Down
16 changes: 8 additions & 8 deletions security/manager/ssl/tests/unit/test_ev_certs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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);
});

Expand Down
40 changes: 20 additions & 20 deletions services/common/blocklist-clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();

Expand Down Expand Up @@ -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)
);
Loading

0 comments on commit 09d0e16

Please sign in to comment.