Don't show nsIChannel passwords in debug output

This commit is contained in:
Dan Stillman 2013-03-26 16:00:55 -04:00
parent a3205de571
commit 0b82266882
2 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,19 @@ Zotero.HTTP = new function() {
this.xmlhttp = xmlhttp;
this.status = xmlhttp.status;
this.message = msg;
// Hide password from debug output
//
// Password also shows up in channel.name (nsIRequest.name), but that's
// read-only and has to be handled in Zotero.varDump()
try {
if (xmlhttp.channel.URI.password) {
xmlhttp.channel.URI.password = "********";
}
}
catch (e) {
Zotero.debug(e, 1);
}
};
this.UnexpectedStatusException.prototype.toString = function() {

View File

@ -1136,6 +1136,9 @@ Zotero.Utilities = {
}
if (typeof(arr) == 'object') { // Array/Hashes/Objects
let isRequest = ((Zotero.isFx && !Zotero.isBookmarklet) || Zotero.isStandalone)
&& arr instanceof Components.interfaces.nsIRequest;
//array for checking recursion
//initialise at first itteration
if(!parentObjects) {
@ -1145,6 +1148,12 @@ Zotero.Utilities = {
for (var item in arr) {
try {
// Don't display nsIRequest.name, which can contain password
if (isRequest && item == 'name') {
dumped_text += level_padding + "'" + item + "' => <<Skipped>>\n";
continue;
}
var value = arr[item];
} catch(e) {
dumped_text += level_padding + "'" + item + "' => <<Access Denied>>\n";