@infosupport/huddle-cli 0.0.0-experiment-160.97.1 → 0.0.0-experiment-160.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/init.js +3 -0
- package/dist/pipe/tools.js +14 -16
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -178,6 +178,9 @@ async function runInit(opts, images) {
|
|
|
178
178
|
dockerArgs.push('-v', `${runtime.socketPath}:/var/run/docker.sock`);
|
|
179
179
|
dockerArgs.push('-v', `${hostTmpSockets}:/tmp/dc-sockets`);
|
|
180
180
|
dockerArgs.push('-v', `${config_1.CONFIG_DIR}:/huddle-home:rw`, '-e', 'HUDDLE_HOME_DIR=/huddle-home');
|
|
181
|
+
// Its host path, so the gateway can refuse mounts that would expose it (the
|
|
182
|
+
// operator token in config.json, the host pipe) to a devcontainer or sandbox.
|
|
183
|
+
dockerArgs.push('-e', `HUDDLE_HOST_HOME_DIR=${config_1.CONFIG_DIR}`);
|
|
181
184
|
if (fwFolder)
|
|
182
185
|
dockerArgs.push('-v', `${fwFolder}:/firewall-rules:rw`);
|
|
183
186
|
if (extFolder)
|
package/dist/pipe/tools.js
CHANGED
|
@@ -61,23 +61,21 @@ function resolveTool(name) {
|
|
|
61
61
|
const bins = override ? [override] : spec.bins;
|
|
62
62
|
const dirs = (process.env.PATH ?? '').split(path_1.default.delimiter).filter(Boolean);
|
|
63
63
|
let refused;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
continue;
|
|
77
|
-
if (isRunnableFile(file))
|
|
78
|
-
return { path: file };
|
|
79
|
-
}
|
|
64
|
+
// Every file to try, in order. A bin with a directory in it is a path, not a
|
|
65
|
+
// name to look up on PATH.
|
|
66
|
+
const files = bins
|
|
67
|
+
.flatMap((bin) => (bin.includes('/') || bin.includes('\\') ? [path_1.default.resolve(bin)] : dirs.map((d) => path_1.default.join(d, bin))))
|
|
68
|
+
.flatMap(candidates);
|
|
69
|
+
for (const file of files) {
|
|
70
|
+
const ext = path_1.default.extname(file).toLowerCase();
|
|
71
|
+
// On Windows, skip batch files (they go through cmd.exe) and non-executables.
|
|
72
|
+
if (process.platform === 'win32' && !WIN_RUNNABLE_EXT.has(ext)) {
|
|
73
|
+
if (REFUSED_EXT.has(ext) && isRunnableFile(file))
|
|
74
|
+
refused ??= file;
|
|
75
|
+
continue;
|
|
80
76
|
}
|
|
77
|
+
if (isRunnableFile(file))
|
|
78
|
+
return { path: file };
|
|
81
79
|
}
|
|
82
80
|
if (refused) {
|
|
83
81
|
return { error: new protocol_1.PipeError('not_allowed', `refusing to run ${refused}: batch files go through cmd.exe`) };
|
package/package.json
CHANGED