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

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



Title: GitLab

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

Commits:

  • 266b210c
    by Pier Angelo Vendrame at 2026-07-22T15:13: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
    ... ... @@ -336,14 +336,22 @@ var read_setting_from_prefs = function (prefNames) {
    336 336
         // For the given settingIndex, check if all current pref values
    
    337 337
         // match the setting.
    
    338 338
         for (const prefName of prefNames) {
    
    339
    -      const wanted = kSecuritySettings[prefName][settingIndex];
    
    340
    -      const actual = Services.prefs.getBoolPref(prefName);
    
    341
    -      if (wanted !== actual) {
    
    342
    -        possibleSetting = false;
    
    343
    -        logger.debug(
    
    344
    -          `${prefName} does not match level ${settingIndex}: ${actual}, should be ${wanted}!`
    
    345
    -        );
    
    346
    -        break;
    
    339
    +      try {
    
    340
    +        const wanted = kSecuritySettings[prefName][settingIndex];
    
    341
    +        const actual = Services.prefs.getBoolPref(prefName);
    
    342
    +        if (wanted !== actual) {
    
    343
    +          possibleSetting = false;
    
    344
    +          logger.debug(
    
    345
    +            `${prefName} does not match level ${settingIndex}: ${actual}, should be ${wanted}!`
    
    346
    +          );
    
    347
    +          break;
    
    348
    +        }
    
    349
    +      } catch (e) {
    
    350
    +        // All the relevant prefs must have a defined default.
    
    351
    +        // If we get here, a preference might have been dropped upstream,
    
    352
    +        // therefore it makes sense to ignore it to determine the security
    
    353
    +        // level, but warn so that we have a look at what went wrong.
    
    354
    +        logger.warn(`Cannot get the value for ${prefName}`, e);
    
    347 355
           }
    
    348 356
         }
    
    349 357
         if (possibleSetting) {
    

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