forked from olcxjas-softworks/LarpixClient
update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
44
electron/node_modules/tmp/lib/tmp.js
generated
vendored
44
electron/node_modules/tmp/lib/tmp.js
generated
vendored
|
|
@ -525,6 +525,29 @@ function _generateTmpName(opts) {
|
|||
return path.join(tmpDir, opts.dir, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the prefix, postfix, and template options.
|
||||
*
|
||||
* Rejects non-string inputs so that a non-string `.includes('..')` cannot evade
|
||||
* the substring check (e.g. an Array whose `.includes('..')` is element-wise,
|
||||
* or a duck-typed object with a custom `.includes`), and so that the value is
|
||||
* not later coerced to a string with traversal sequences via `Array.prototype.join`
|
||||
* or `path.join`.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function _assertPath(option, value) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error(`${option} option must be a string, got "${typeof value}".`);
|
||||
}
|
||||
|
||||
if (value.includes("..")) {
|
||||
throw new Error("Relative value not allowed");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts and sanitizes the basic options.
|
||||
*
|
||||
|
|
@ -539,13 +562,19 @@ function _assertOptionsBase(options) {
|
|||
|
||||
// must not fail on valid .<name> or ..<name> or similar such constructs
|
||||
const basename = path.basename(name);
|
||||
if (basename === '..' || basename === '.' || basename !== name)
|
||||
if (basename === '..' || basename === '.' || basename !== name) {
|
||||
throw new Error(`name option must not contain a path, found "${name}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
|
||||
throw new Error(`Invalid template, found "${options.template}".`);
|
||||
if (!_isUndefined(options.template)) {
|
||||
if (typeof options.template !== 'string') {
|
||||
throw new Error(`template option must be a string, got "${typeof options.template}".`);
|
||||
}
|
||||
if (!options.template.match(TEMPLATE_PATTERN)) {
|
||||
throw new Error(`Invalid template, found "${options.template}".`);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
|
|
@ -561,8 +590,9 @@ function _assertOptionsBase(options) {
|
|||
options.unsafeCleanup = !!options.unsafeCleanup;
|
||||
|
||||
// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
|
||||
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
|
||||
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
|
||||
options.prefix = _isUndefined(options.prefix) ? '' : _assertPath('prefix', options.prefix);
|
||||
options.postfix = _isUndefined(options.postfix) ? '' : _assertPath('postfix', options.postfix);
|
||||
options.template = _isUndefined(options.template) ? undefined : _assertPath('template', options.template);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -578,7 +608,7 @@ function _getRelativePath(option, name, tmpDir, cb) {
|
|||
|
||||
const relativePath = path.relative(tmpDir, resolvedPath);
|
||||
|
||||
if (!resolvedPath.startsWith(tmpDir)) {
|
||||
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
||||
return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`));
|
||||
}
|
||||
|
||||
|
|
@ -597,7 +627,7 @@ function _getRelativePathSync(option, name, tmpDir) {
|
|||
const resolvedPath = _resolvePathSync(name, tmpDir);
|
||||
const relativePath = path.relative(tmpDir, resolvedPath);
|
||||
|
||||
if (!resolvedPath.startsWith(tmpDir)) {
|
||||
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
||||
throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue