summaryrefslogtreecommitdiffstats
path: root/glances/outputs/static/public/glances.js
diff options
context:
space:
mode:
Diffstat (limited to 'glances/outputs/static/public/glances.js')
-rw-r--r--glances/outputs/static/public/glances.js70
1 files changed, 59 insertions, 11 deletions
diff --git a/glances/outputs/static/public/glances.js b/glances/outputs/static/public/glances.js
index eb448a6d..16ccb505 100644
--- a/glances/outputs/static/public/glances.js
+++ b/glances/outputs/static/public/glances.js
@@ -556,14 +556,15 @@ function updateLink (link, options, obj) {
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.17.19';
+ var VERSION = '4.17.21';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Error message constants. */
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
- FUNC_ERROR_TEXT = 'Expected a function';
+ FUNC_ERROR_TEXT = 'Expected a function',
+ INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -696,10 +697,11 @@ function updateLink (link, options, obj) {
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
- /** Used to match leading and trailing whitespace. */
- var reTrim = /^\s+|\s+$/g,
- reTrimStart = /^\s+/,
- reTrimEnd = /\s+$/;
+ /** Used to match leading whitespace. */
+ var reTrimStart = /^\s+/;
+
+ /** Used to match a single whitespace character. */
+ var reWhitespace = /\s/;
/** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
@@ -709,6 +711,18 @@ function updateLink (link, options, obj) {
/** Used to match words composed of alphanumeric characters. */
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
+ /**
+ * Used to validate the `validate` option in `_.template` variable.
+ *
+ * Forbids characters which could potentially change the meaning of the function argument definition:
+ * - "()," (modification of function parameters)
+ * - "=" (default value)
+ * - "[]{}" (destructuring of function parameters)
+ * - "/" (beginning of a comment)
+ * - whitespace
+ */
+ var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
+
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
@@ -1538,6 +1552,19 @@ function updateLink (link, options, obj) {
}
/**
+ * The base implementation of `_.trim`.
+ *
+ * @private
+ * @param {string} string The string to trim.
+ * @returns {string} Returns the trimmed string.
+ */
+ function baseTrim(string) {
+ return string
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
+ : string;
+ }
+
+ /**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
@@ -1871,6 +1898,21 @@ function updateLink (link, options, obj) {
}
/**
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the last non-whitespace character.
+ */
+ function trimmedEndIndex(string) {
+ var index = string.length;
+
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
+ return index;
+ }
+
+ /**
* Used by `_.unescape` to convert HTML entities to characters.
*
* @private
@@ -13038,7 +13080,7 @@ function updateLink (link, options, obj) {
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
- value = value.replace(reTrim, '');
+ value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
@@ -15410,6 +15452,12 @@ function updateLink (link, options, obj) {
if (!variable) {
source = 'with (obj) {\n' + source + '\n}\n';
}
+ // Throw an error if a forbidden character was found in `variable`, to prevent
+ // potential command injection attacks.
+ else if (reForbiddenIdentifierChars.test(variable)) {
+ throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
+ }
+
// Cleanup code by stripping empty strings.
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
.replace(reEmptyStringMiddle, '$1')
@@ -15523,7 +15571,7 @@ function updateLink (link, options, obj) {
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
- return string.replace(reTrim, '');
+ return baseTrim(string);
}
if (!string || !(chars = baseToString(chars))) {
return string;
@@ -15558,7 +15606,7 @@ function updateLink (link, options, obj) {
function trimEnd(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
- return string.replace(reTrimEnd, '');
+ return string.slice(0, trimmedEndIndex(string) + 1);
}
if (!string || !(chars = baseToString(chars))) {
return string;
@@ -16132,7 +16180,7 @@ function updateLink (link, options, obj) {
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
*
* // Checking for several possible values
- * _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
+ * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
*/
function matches(source) {
@@ -16169,7 +16217,7 @@ function updateLink (link, options, obj) {
* // => { 'a': 4, 'b': 5, 'c': 6 }
*
* // Checking for several possible values
- * _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
+ * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
*/
function matchesProperty(path, srcValue) {