Closed Bug 1558640 Opened 5 years ago Closed 5 years ago

cert storage remote settings client should be accessible somehow and not create a one-off instance without any references

Categories

(Core :: Security: PSM, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox69 --- wontfix
firefox73 --- fixed

People

(Reporter: Gijs, Assigned: keeler)

References

Details

(Whiteboard: [psm-assigned])

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/c606cdd6d014fee4034da1702d484c0d41b604c9/security/manager/ssl/RemoteSecuritySettings.jsm#107-133

    static init() {
      // In Bug 1543598, the OneCRL and Pinning clients will be moved in this module.
      BlocklistClients.initialize();

      if (AppConstants.MOZ_NEW_CERT_STORAGE) {
        new RemoteSecuritySettings();
      }
    }

    constructor() {
        this.client = RemoteSettings(Services.prefs.getCharPref(INTERMEDIATES_COLLECTION_PREF), {
          bucketNamePref: INTERMEDIATES_BUCKET_PREF,
          lastCheckTimePref: INTERMEDIATES_CHECKED_SECONDS_PREF,
          signerName: Services.prefs.getCharPref(INTERMEDIATES_SIGNER_PREF),
          localFields: ["cert_import_complete"],
        });

        this.client.on("sync", this.onSync.bind(this));
        Services.obs.addObserver(this.onObservePollEnd.bind(this),
                                 "remote-settings:changes-poll-end");
        ...
    }

OK, so... we never put the result of calling the RemoteSecuritySettings constructor anywhere.

Normally, that would get it GC'd. However, in this case, we pass a reference to the client it creates which is bound to this via onSync, so if the remote settings code keeps a ref to client then that will keep it alive, and even if not, the addObserver call is bound to this so that will keep it alive.

But that's all pretty scary, and there's no way to call maybeSync or anything on this instance for debug purposes and that's kind of annoying.

Can we make it a global and/or "root" the result of the new RemoteSecuritySettings call a bit better so it staying alive isn't this kind of accident? :-)

(I should really have caught this in review...)

The priority flag is not set for this bug.
:keeler, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dkeeler)

The details have changed a bit, but I think the underlying issue is still present.

Assignee: nobody → dkeeler
Flags: needinfo?(dkeeler)
Priority: -- → P1
Whiteboard: [psm-assigned]
Pushed by dkeeler@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f96085fa8749 make RemoteSecuritySettings retain references to its remote settings clients r=Gijs
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: