@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 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)
@@ -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
- for (const bin of bins) {
65
- // A bin with a directory in it is a path, not a name to look up on PATH.
66
- const lookups = bin.includes('/') || bin.includes('\\') ? [path_1.default.resolve(bin)] : dirs.map((d) => path_1.default.join(d, bin));
67
- for (const lookup of lookups) {
68
- for (const file of candidates(lookup)) {
69
- const ext = path_1.default.extname(file).toLowerCase();
70
- if (process.platform === 'win32' && REFUSED_EXT.has(ext)) {
71
- if (isRunnableFile(file))
72
- refused ??= file;
73
- continue;
74
- }
75
- if (process.platform === 'win32' && !WIN_RUNNABLE_EXT.has(ext))
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infosupport/huddle-cli",
3
- "version": "0.0.0-experiment-160.97.1",
3
+ "version": "0.0.0-experiment-160.99.1",
4
4
  "description": "Huddle CLI — start devcontainers and manage firewall rules",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "author": "Info Support B.V.",