Closed Bug 1389664 Opened 8 years ago Closed 8 years ago

have PSM always initialize the user's pin to the empty string if necessary at startup

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: keeler, Assigned: keeler)

References

Details

(Whiteboard: [psm-assigned])

Attachments

(1 file)

Currently in NSS_DISABLE_DBM builds, we have a method attemptToLogInWithDefaultPassword() that we call as-needed that sets the database password to the empty string if NSS thinks this is necessary (and this is necessary to get tests to pass on Android - see bug 978120). We were never entirely confident in this solution, so it remained rather ad-hoc. After some investigation, it appears that this does do the correct thing with respect to behavior compatibility with the old database. However, it would be best to move this to a more logical, centralized location (with the added benefit that we only attempt this initialization once per run). Also, we can take away the #ifdefs and unify the code a bit.
Comment on attachment 8896493 [details] bug 1389664 - centralize on-demand empty pin initialization of the user's NSS database https://reviewboard.mozilla.org/r/167742/#review173300 ::: security/certverifier/NSSCertDBTrustDomain.cpp:1263 (Diff revision 1) > + // true. For the SQL DB, we need to set a password or we won't be able to > + // import any certificates or change trust settings. > + // In gtests, NSS may have already been initialized in no-DB mode. Oddly, > + // PK11_NeedUserInit will return true, but PK11_InitPin will fail. Work > + // around this by confirming that we don't have a read-only internal slot. > + // This is bug 1389570. We should probably get bug 1389570 fixed before landing this and not do the workaround. I'll look at bug 1389570 later and see what I can do.
Hmmm... Keeler: Since so much of this is changing pk11tokendb.initPassword to pk11tokendb.changePassword, should initPassword get changed in some way, too?
Comment on attachment 8896493 [details] bug 1389664 - centralize on-demand empty pin initialization of the user's NSS database https://reviewboard.mozilla.org/r/167742/#review174550 Other than my comment, it looks pretty good. I agree with Franziskus about the change at NSS landing first though. ::: security/manager/ssl/tests/unit/test_certDB_import_with_master_password.js:111 (Diff revision 1) > > // Set a master password. > let tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"] > .getService(Ci.nsIPK11TokenDB); > let token = tokenDB.getInternalKeyToken(); > - token.initPassword("password"); > + token.changePassword("", "password"); It seems to me that we might want to fix whatever prompted us to have to not use `initPassword` here, because it's non-obvious that on a fresh profile we should need to `changePassword` from the empty string. Perhaps we can just rework `initPassword` in a follow-up to be syntactic sugar for calling `changePassword('', aNewPassword)` ?
Attachment #8896493 - Flags: review?(jjones)
Depends on: 1389570
NSS tip with the fix for bug 1389570 landed on inbound.
Or maybe not. I had to back out again. I have to fix all those tests first :(
Attachment #8896493 - Flags: review?(cykesiopka.bmo)
(clearing reviews for now)
Comment on attachment 8896493 [details] bug 1389664 - centralize on-demand empty pin initialization of the user's NSS database https://reviewboard.mozilla.org/r/167742/#review177022 This looks good to me now.
Attachment #8896493 - Flags: review?(jjones) → review+
Comment on attachment 8896493 [details] bug 1389664 - centralize on-demand empty pin initialization of the user's NSS database https://reviewboard.mozilla.org/r/167742/#review177498 Looks good.
Attachment #8896493 - Flags: review?(cykesiopka.bmo) → review+
Pushed by dkeeler@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/192a101ff358 centralize on-demand empty pin initialization of the user's NSS database r=Cykesiopka,jcj
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: