web-manager 3.2.63 → 3.2.64
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/utilities.js +11 -21
- package/package.json +1 -1
package/lib/utilities.js
CHANGED
@@ -108,29 +108,19 @@ Utilities.clipboardCopy = function (input) {
|
|
108
108
|
Utilities.escapeHTML = function (str) {
|
109
109
|
shadow = shadow || document.createElement('p');
|
110
110
|
shadow.innerHTML = '';
|
111
|
+
|
112
|
+
// This automatically escapes HTML entities like <, >, &, etc.
|
111
113
|
shadow.appendChild(document.createTextNode(str));
|
112
114
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
// case '&':
|
123
|
-
// return '&';
|
124
|
-
// case '<':
|
125
|
-
// return '<';
|
126
|
-
// case '>':
|
127
|
-
// return '>';
|
128
|
-
// case '"':
|
129
|
-
// return '"';
|
130
|
-
// case "'":
|
131
|
-
// return ''';
|
132
|
-
// }
|
133
|
-
// });
|
115
|
+
// This is needed to escape quotes to prevent attribute injection
|
116
|
+
return shadow.innerHTML.replace(/["']/g, function(m) {
|
117
|
+
switch (m) {
|
118
|
+
case '"':
|
119
|
+
return '"';
|
120
|
+
default:
|
121
|
+
return ''';
|
122
|
+
}
|
123
|
+
});
|
134
124
|
}
|
135
125
|
|
136
126
|
Utilities.getContext = function () {
|
package/package.json
CHANGED