Closed Bug 396295 Opened 17 years ago Closed 17 years ago

non-HTTP password management is broken

Categories

(Toolkit :: Password Manager, defect, P3)

x86
Windows XP
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: asqueella, Assigned: asqueella)

References

()

Details

(Keywords: regression)

Attachments

(2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
QueryInterface throws, not returns null.

The patch also cleans up some code.
Flags: blocking-firefox3?
Attachment #281036 - Flags: review?(dolske)
Comment on attachment 281036 [details] [diff] [review]
patch

There's more brokenness...
Attachment #281036 - Attachment is obsolete: true
Attachment #281036 - Flags: review?(dolske)
Summary: nsLoginManagerPrompter._GetAuthKey is broken → non-HTTP password management is broken
Attached patch patch (obsolete) — Splinter Review
For non-HTTP auth (e.g. FTP) there's no "realm", as far as I can see. Current code assumes there either is a actionURL or a "realm". The updated patch fixes this assumption, while also fixing the typos in the prompter.

I checked that old signons for HTTP/FTP/form authorization are loaded properly and that FTP logins can now be saved.

I'm not familiar with the login manager, so I may be breaking something else.
Attachment #281043 - Flags: review?(dolske)
Blocks: 374723
Comment on attachment 281043 [details] [diff] [review]
patch

>Index: toolkit/components/passwordmgr/src/nsLoginManager.js
>===================================================================
>-        if (!login.httpRealm && !login.formSubmitURL)
>-            throw "Can't add a login without a httpRealm or formSubmitURL.";
>-

Keep this (see next comment).

>+        if (!(aChannel instanceof Ci.nsIHttpChannel)) {
>             key = aChannel.URI.prePath;
>-            this.log("_GetAuthKey: got http channel, key is: " + key);
>-            return key;
>+            this.log("_GetAuthKey: got non-http channel, key is: " + key);
>+            return [key, null];

I think this should be |return [key, key];|, so that the "httpRealm" for non-HTTP connections is the same as the hostname. [This should also be what happens when an HTTP 401 response doesn't include an explicit realm, although now I want to test that. :-(]

>                 case STATE.ACTIONURL:
>-                    var formSubmitURL = line.value;
>-                    if (!formSubmitURL && entry.httpRealm)
>-                        entry.formSubmitURL = null;
>-                    else
>-                        entry.formSubmitURL = formSubmitURL;
>+                    entry.formSubmitURL = line.value ? line.value : null; 

Keep this (see previous comment).

The rest looks good, great catch!
Attachment #281043 - Flags: review?(dolske) → review-
Sorry, didn't get to updating the patch quickly -- had to go. Should this be marked a dupe of bug 396316, now that you're fixing these typos in a patch there?

An alternative would be to check in my (temporary) fix here if the other bug might take longer to get fixed. In that case, I think returning [key, null] is better, since that's compatible with the old signons2.txt format. The security issue can then be fixed in bug 396316 (along with the necessary signons.txt migration code).
It's probably easiest to just fix the typos and other issues as part of 396316, and then marked this bug as FIXED. I don't think this patch is correct as a temporary fix, and it's probably best to just avoid getting entangled in issues that 396316 will fix anyway.
Depends on: 396316
(Blocking to ensure that this gets resolved, even if it does so as described in comment 5)
Flags: blocking-firefox3? → blocking-firefox3+
Target Milestone: --- → Firefox 3 M10
Priority: -- → P3
Target Milestone: Firefox 3 M10 → Firefox 3 M11
Bug 396316 landed yesterday, and this now seems to be fixed.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Attachment #281043 - Attachment is obsolete: true
Yeah, this is fixed now. Too bad I can't reassign to you without reopening and thus causing a little bugspamfest...
Status: RESOLVED → VERIFIED
Target Milestone: Firefox 3 beta3 → ---
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: