Add a filter to catch XSS-like entities and also stub a on-load test which would otherwise make pads inaccessable.
This commit is contained in:
@@ -313,6 +313,10 @@ define([
|
|||||||
if (!readOnly && !initializing) {
|
if (!readOnly && !initializing) {
|
||||||
userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf
|
userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf
|
||||||
}
|
}
|
||||||
|
$(userDocStateDom).find('script, applet, object, iframe').remove();
|
||||||
|
$(userDocStateDom).find('a').filter(function (i, x) {
|
||||||
|
return ! /^(https|http|ftp):\/\/[^\s\n]*$/.test(x.getAttribute('href'));
|
||||||
|
}).remove();
|
||||||
var patch = (DD).diff(inner, userDocStateDom);
|
var patch = (DD).diff(inner, userDocStateDom);
|
||||||
(DD).apply(inner, patch);
|
(DD).apply(inner, patch);
|
||||||
if (readOnly) {
|
if (readOnly) {
|
||||||
@@ -625,8 +629,10 @@ define([
|
|||||||
if (stringify(hjson2) !== stringify(hjson)) {
|
if (stringify(hjson2) !== stringify(hjson)) {
|
||||||
console.log('err');
|
console.log('err');
|
||||||
console.error("shjson2 !== shjson");
|
console.error("shjson2 !== shjson");
|
||||||
Cryptpad.errorLoadingScreen(Messages.wrongApp);
|
// TODO(cjd): This is removed because the XSS filter in applyHjson()
|
||||||
throw new Error();
|
// is applied on incoming content so it causes this to fail.
|
||||||
|
//Cryptpad.errorLoadingScreen(Messages.wrongApp);
|
||||||
|
//throw new Error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user