1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-09-21 09:21:34 +02:00

Fixed issues reported by cure53.de

Fixed issues CLP-01-014 and CLP-01-015
This commit is contained in:
Giulio Cesare Solaroli 2014-05-02 17:14:18 +02:00
parent 03659f6b3d
commit ed6b4edc82
No known key found for this signature in database
GPG Key ID: 22E34C908F02CBA2
5 changed files with 47 additions and 11 deletions

View File

@ -246,6 +246,34 @@ MochiKit.Base.update(Clipperz.Base, {
return result; return result;
}, },
'javascriptInjectionPattern': new RegExp("javascript:\/\/\"", "g"),
'sanitizeUrl': function(aValue) {
var result;
if ((aValue != null) && this.javascriptInjectionPattern.test(aValue)) {
result = aValue.replace(this.javascriptInjectionPattern, '');
console.log("sanitized url", aValue, result);
} else {
result = aValue;
}
return result;
},
'sanitizeFavicon': function(aValue) {
var result;
if ((aValue != null) && this.javascriptInjectionPattern.test(aValue)) {
result = aValue.replace(this.javascriptInjectionPattern, '');
console.log("sanitized favicon", aValue, result);
} else {
result = aValue;
}
return result;
},
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
'exception': { 'exception': {

View File

@ -138,7 +138,7 @@ Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, {
if (this._hostname == null) { if (this._hostname == null) {
var actionUrl; var actionUrl;
actionUrl = this.configuration()['form']['attributes']['action']; actionUrl = Clipperz.Base.sanitizeUrl(this.configuration()['form']['attributes']['action']);
//MochiKit.Logging.logDebug("+++ actionUrl: " + actionUrl); //MochiKit.Logging.logDebug("+++ actionUrl: " + actionUrl);
this._hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); this._hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
} }

View File

@ -100,7 +100,7 @@ YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, C
result.push(option); result.push(option);
for (recordFieldKey in recordFields) { for (recordFieldKey in recordFields) {
// TODO: remove the value: field and replace it with element.dom.value = <some value> // TODO: remove the value: field and replace it with element.dom.value = <some value>
option = {tag:'option', value:recordFieldKey, html:recordFields[recordFieldKey].label()} option = {tag:'option', value:recordFieldKey, html:Clipperz.Base.sanitizeString(recordFields[recordFieldKey].label())}
if (recordFieldKey == this.directLoginBinding().fieldKey()) { if (recordFieldKey == this.directLoginBinding().fieldKey()) {
option['selected'] = true; option['selected'] = true;
} }
@ -150,7 +150,7 @@ YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, C
this.getElement('editModeBox').hide(); this.getElement('editModeBox').hide();
this.getElement('viewModeBox').show(); this.getElement('viewModeBox').show();
this.getElement('viewValue').update(this.directLoginBinding().field().label()); this.getElement('viewValue').update(Clipperz.Base.sanitizeString(this.directLoginBinding().field().label()));
//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode"); //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode");
}, },

View File

@ -38,7 +38,7 @@ Clipperz.PM.DataModel.DirectLogin = function(args) {
this._record = args.record || null; this._record = args.record || null;
this._label = args.label || "unnamed record" this._label = args.label || "unnamed record"
this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
this._favicon = args.favicon || null; this._favicon = Clipperz.Base.sanitizeFavicon(args.favicon) || null;
this._bookmarkletVersion = args.bookmarkletVersion || "0.1"; this._bookmarkletVersion = args.bookmarkletVersion || "0.1";
this._directLoginInputs = null; this._directLoginInputs = null;
@ -102,9 +102,9 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
var actionUrl; var actionUrl;
var hostname; var hostname;
actionUrl = this.formData()['attributes']['action']; actionUrl = this.action();
hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
this._favicon = "http://" + hostname + "/favicon.ico"; this._favicon = Clipperz.Base.sanitizeFavicon("http://" + hostname + "/favicon.ico");
} }
return this._favicon; return this._favicon;
@ -137,6 +137,14 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
this._fixedFavicon = aValue; this._fixedFavicon = aValue;
}, },
'action': function () {
var result;
result = Clipperz.Base.sanitizeUrl(this.formData()['attributes']['action']);
return result;
},
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
'bookmarkletVersion': function() { 'bookmarkletVersion': function() {
@ -442,7 +450,7 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
//MochiKit.Logging.logDebug("### runDirectLogin - 4"); //MochiKit.Logging.logDebug("### runDirectLogin - 4");
//console.log(this.formData()['attributes']); //console.log(this.formData()['attributes']);
formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, { 'method':this.formData()['attributes']['method'], formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, { 'method':this.formData()['attributes']['method'],
'action':this.formData()['attributes']['action']})); 'action': this.action()}));
//MochiKit.Logging.logDebug("### runDirectLogin - 5"); //MochiKit.Logging.logDebug("### runDirectLogin - 5");
formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); formSubmitFunction = MochiKit.Base.method(formElement, 'submit');
//MochiKit.Logging.logDebug("### runDirectLogin - 6"); //MochiKit.Logging.logDebug("### runDirectLogin - 6");
@ -487,9 +495,9 @@ Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
//console.log("formData.attributes", this.formData()['attributes']); //console.log("formData.attributes", this.formData()['attributes']);
// if (/^javascript/.test(this.formData()['attributes']['action'])) { // if (/^javascript/.test(this.formData()['attributes']['action'])) {
if ((/^(https?|webdav|ftp)\:/.test(this.formData()['attributes']['action']) == false) && if ((/^(https?|webdav|ftp)\:/.test(this.action()) == false) &&
(this.formData()['attributes']['type'] != 'http_auth')) (this.formData()['attributes']['type'] != 'http_auth')
{ ) {
var messageBoxConfiguration; var messageBoxConfiguration;
if (typeof(aNewWindow) != 'undefined') { if (typeof(aNewWindow) != 'undefined') {

View File

@ -47,7 +47,7 @@ Clipperz.PM.DataModel.DirectLoginReference = function(args) {
this._reference = args.reference; this._reference = args.reference;
this._recordReference = args.record; this._recordReference = args.record;
this._label = args.label; this._label = args.label;
this._favicon = args.favicon || null; this._favicon = Clipperz.Base.sanitizeFavicon(args.favicon) || null;
this._directLogin = null; this._directLogin = null;
this._record = null; this._record = null;