@hadoku/dev-vault 1.5.2 → 1.5.3

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/dev-vault.mjs CHANGED
@@ -73,6 +73,7 @@
73
73
  */
74
74
 
75
75
  import { spawn } from 'node:child_process';
76
+ import { spawnSpec } from './spawn-spec.mjs';
76
77
  import { existsSync, readFileSync } from 'node:fs';
77
78
  import { resolve } from 'node:path';
78
79
  import process from 'node:process';
@@ -330,7 +331,11 @@ if (!process.env.NODE_AUTH_TOKEN && fetched.HADOKU_NPM_READ_TOKEN) {
330
331
  // guard that consumed this was removed 2026-08-03 — pnpm 11 runs preinstall
331
332
  // AFTER dependency fetch, so it could never rescue an unauthenticated
332
333
  // install; `pnpm vault-install` is the documented path.)
333
- const child = spawn(childCmd[0], childCmd.slice(1), {
334
+ // Through cmd.exe on Windows, where pnpm/vite/playwright are .cmd shims
335
+ // (spawn-spec.mjs).
336
+ const [spawnCmd, spawnArgs, spawnOpts] = spawnSpec(childCmd);
337
+ const child = spawn(spawnCmd, spawnArgs, {
338
+ ...spawnOpts,
334
339
  stdio: 'inherit',
335
340
  env: { ...process.env, ...fetched, ...derived, HADOKU_DEV_VAULT_ACTIVE: '1' },
336
341
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/dev-vault",
3
- "version": "1.5.2",
4
- "gitHead": "9010a68c19d319334869bb549bc90acc1ee4d0ca",
3
+ "version": "1.5.3",
4
+ "gitHead": "4942c6f53fb701a7ba3f411dbb76c55ec65d1b9c",
5
5
  "description": "Local-dev vault-broker shim — fetches secrets from the hadoku mgmt-api broker and execs a child command with them in process.env. Works for any consuming repo (Node or non-Node).",
6
6
  "type": "module",
7
7
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "key-file.mjs",
14
14
  "install-id.mjs",
15
15
  "login.mjs",
16
+ "spawn-spec.mjs",
16
17
  "README.md",
17
18
  "LICENSE"
18
19
  ],
package/spawn-spec.mjs ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * How to start the child command on this platform.
3
+ *
4
+ * On Windows, `pnpm`, `vite`, `playwright` and every other npm-installed
5
+ * command is a `.cmd` shim, and Node starts a `.cmd` only through a shell
6
+ * (since Node 20.12 it refuses outright, CVE-2024-27980). Spawned bare,
7
+ * `dev-vault -- pnpm install` failed with ENOENT/EINVAL for every Windows
8
+ * contributor, which is most of the people outside the fleet. So on win32 the
9
+ * child goes through cmd.exe, with each argument quoted where cmd would
10
+ * otherwise split or reinterpret it. Everywhere else nothing changes.
11
+ */
12
+
13
+ /** One argument as cmd.exe reads it back verbatim. */
14
+ export function quoteForCmd(arg) {
15
+ if (arg !== '' && !/[\s"&|<>^%()!,;=]/.test(arg)) return arg;
16
+ return `"${arg.replace(/"/g, '""')}"`;
17
+ }
18
+
19
+ /** `[command, args, options]` for `spawn`. */
20
+ export function spawnSpec(argv, platform = process.platform) {
21
+ if (platform !== 'win32') return [argv[0], argv.slice(1), {}];
22
+ return [argv.map(quoteForCmd).join(' '), [], { shell: true }];
23
+ }