Open Bug 927859 Opened 11 years ago Updated 2 years ago

Generate login credentials for test servers in test files on the fly instead of hardcoding them encrypted in signons.sqlite

Categories

(Thunderbird :: Testing Infrastructure, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: aceman, Unassigned)

References

Details

+++ This bug was initially created as a clone of Bug #925489 comment 36 +++

In bug 925489 we stored logins for test servers in encrypted files signons.sqlite (as the simpler format of signons.txt is no longer supported). It looks hard to change these passwords in the future if the need arises. I propose to generate the login information on the fly from each test file. The script at https://bug925489.bugzilla.mozilla.org/attachment.cgi?id=817595 shows this should be possible. If we explicitly list the login/password in each test, it should be easy to change then in the future. The password handling will be less of a black box that it is now (see how we struggled with the key3.db and signons.sqlite file mismatches in bug 925489).
For implementation details, I would suggest to put most of the helper functions from attachment https://bug925489.bugzilla.mozilla.org/attachment.cgi?id=817595 into
mailnews/test/resources/passwordStorage.js

In that same file we could keep the current grouping of the login data, e.g.:

function create_logins_mailnews1.8() {
  let storage = create_login_manager_storage("signons.sqlite");

  add_login(storage,
            "mailbox://localhost", "mailbox://localhost",
            "testpop3", "pop3test");
  add_login(storage,
            "news://localhost", "news://localhost/#password",
            "", "newstest");
  add_login(storage,
            "news://localhost", "news://localhost/#username",
            "", "testnews");
  add_login(storage,
            "smtp://localhost", "smtp://localhost",
            "testsmtp", "smtptest");
}

function create_logins_imap() {
  let storage = create_login_manager_storage("signons.sqlite");

  add_login(storage,
            "imap://localhost", "imap://localhost",
            "user", "imaptest");
}

In this way we could keep the current grouping and sharing of the credentials from various tests. Each test would just call the appropriate function, e.g. create_logins_mailnews1.8() instead of copying the pre-made signons-mailnews1.8.sqlite file.
Of course, if a test wishes so it can keep the passwords private inside its own code. But as currently many tests share the same credentials, we can put them in the shared passwordStorage.js file.

If this works, we can then remove the stored key3.db file from the test data files.

The real question is whether all this is possible. If at the time when this code gets to run, the test runtime didn't already create an empty signons.sqlite file in the test profile of the running TB. And if we are able to replace it, or add to it via proper calls.
https://hg.mozilla.org/mozilla-central/rev/ac3b5c47d520
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 27.0
Intended for bug 927459 (wrong bug number in commit message + script).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: Thunderbird 27.0 → ---
Status: REOPENED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.