[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-153.0esr-16.0-1] fixup! BB 40925: Implemented the Security Level component



Title: GitLab

Pier Angelo Vendrame pushed to branch mullvad-browser-153.0esr-16.0-1 at The Tor Project / Applications / Mullvad Browser

Commits:

  • a8a167fe
    by Pier Angelo Vendrame at 2026-07-22T15:28:09+02:00
    fixup! BB 40925: Implemented the Security Level component
    
    BB 45131: Avoid the unsafe getBoolPref in the security level.
    
    In the security level we use getBoolPref without a default value.
    Therefore it might throw during the initialization of the security
    level.
    
    This case should not happen normally for us, but it might happen if
    upstream removes a preference default, and in that case the security
    level initialization will fail at startup.
    It seems better to handle the case (but add a console warning, so that
    we notice it and investigate it).
    

1 changed file:

Changes:

  • toolkit/components/securitylevel/SecurityLevel.sys.mjs
    ... ... @@ -348,14 +348,22 @@ var read_setting_from_prefs = function (prefNames) {
    348 348
         // For the given settingIndex, check if all current pref values
    
    349 349
         // match the setting.
    
    350 350
         for (const prefName of prefNames) {
    
    351
    -      const wanted = kSecuritySettings[prefName][settingIndex];
    
    352
    -      const actual = Services.prefs.getBoolPref(prefName);
    
    353
    -      if (wanted !== actual) {
    
    354
    -        possibleSetting = false;
    
    355
    -        logger.debug(
    
    356
    -          `${prefName} does not match level ${settingIndex}: ${actual}, should be ${wanted}!`
    
    357
    -        );
    
    358
    -        break;
    
    351
    +      try {
    
    352
    +        const wanted = kSecuritySettings[prefName][settingIndex];
    
    353
    +        const actual = Services.prefs.getBoolPref(prefName);
    
    354
    +        if (wanted !== actual) {
    
    355
    +          possibleSetting = false;
    
    356
    +          logger.debug(
    
    357
    +            `${prefName} does not match level ${settingIndex}: ${actual}, should be ${wanted}!`
    
    358
    +          );
    
    359
    +          break;
    
    360
    +        }
    
    361
    +      } catch (e) {
    
    362
    +        // All the relevant prefs must have a defined default.
    
    363
    +        // If we get here, a preference might have been dropped upstream,
    
    364
    +        // therefore it makes sense to ignore it to determine the security
    
    365
    +        // level, but warn so that we have a look at what went wrong.
    
    366
    +        logger.warn(`Cannot get the value for ${prefName}`, e);
    
    359 367
           }
    
    360 368
         }
    
    361 369
         if (possibleSetting) {
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx