fix(cli): unsafe shell command constructed from library input
This commit is contained in:
parent
c7ef9618a9
commit
5ebd5d5c62
@ -2,7 +2,7 @@ const net = require('net');
|
|||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
const execa = require('execa');
|
const execa = require('execa');
|
||||||
const fg = require('fast-glob');
|
const fg = require('fast-glob');
|
||||||
const { dirname, join, resolve } = require('path');
|
const { dirname, join, resolve, sep } = require('path');
|
||||||
const { readFile, writeFile } = require('fs').promises;
|
const { readFile, writeFile } = require('fs').promises;
|
||||||
const { existsSync, mkdirSync, cpSync, writeFileSync } = require('fs');
|
const { existsSync, mkdirSync, cpSync, writeFileSync } = require('fs');
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ exports.nodeCheck = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.run = (command, argv, options = {}) => {
|
exports.run = (command, args, options = {}) => {
|
||||||
return execa(command, argv, {
|
return execa(command, args, {
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
...options,
|
...options,
|
||||||
@ -189,7 +189,10 @@ exports.genTsConfigPaths = function genTsConfigPaths() {
|
|||||||
packages.forEach((packageFile) => {
|
packages.forEach((packageFile) => {
|
||||||
const packageJsonName = require(packageFile).name;
|
const packageJsonName = require(packageFile).name;
|
||||||
const packageDir = dirname(packageFile);
|
const packageDir = dirname(packageFile);
|
||||||
const relativePath = packageDir.slice(cwdLength + 1).replace(/\\/, '/');
|
const relativePath = packageDir
|
||||||
|
.slice(cwdLength + 1)
|
||||||
|
.split(sep)
|
||||||
|
.join('/');
|
||||||
paths[packageJsonName] = [`${relativePath}/src`];
|
paths[packageJsonName] = [`${relativePath}/src`];
|
||||||
paths[`${packageJsonName}/client`] = [`${relativePath}/src/client`];
|
paths[`${packageJsonName}/client`] = [`${relativePath}/src/client`];
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user