@lifeaitools/clauth 2.0.1 → 2.0.2
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/cli/supervisor-registry.js +20 -2
- package/cli/supervisor-registry.test.js +926 -889
- package/package.json +1 -1
|
@@ -167,7 +167,14 @@ function normalizeCommand(command, field) {
|
|
|
167
167
|
const [cmd, ...args] = command;
|
|
168
168
|
if (typeof cmd !== "string" || !cmd.trim()) throw new Error(`${field}[0] is required`);
|
|
169
169
|
if (/[;&|<>]/.test(cmd)) throw new Error(`${field}[0] must be an executable path/name, not shell syntax`);
|
|
170
|
-
|
|
170
|
+
// Expand the same path tokens `cwd` already gets. Until now expandPathToken()
|
|
171
|
+
// was applied ONLY to cwd, so a manifest naming a root inside a command
|
|
172
|
+
// argument shipped the literal string to the shell — dev-center's
|
|
173
|
+
// "$LIFEAI_ENV/services/restart-dev-center.ps1" reached pwsh unexpanded and
|
|
174
|
+
// exited 64. Expanding here, AFTER the shell-syntax checks on cmd and BEFORE
|
|
175
|
+
// the per-arg checks below, keeps the injection guard authoritative over the
|
|
176
|
+
// final value rather than the pre-expansion one.
|
|
177
|
+
const normalizedArgs = args.map((a) => expandPathToken(String(a)) ?? String(a));
|
|
171
178
|
// shell:true (Windows-only, see execute() in runSurfaceAction) hands each
|
|
172
179
|
// arg to cmd.exe verbatim — a shell metacharacter in an arg is exactly as
|
|
173
180
|
// exploitable as one in cmd[0]. A legitimate CLI arg for the pm2/node
|
|
@@ -192,13 +199,24 @@ export function shellQuote(value, useShell) {
|
|
|
192
199
|
function expandPathToken(value) {
|
|
193
200
|
if (!value) return null;
|
|
194
201
|
const root = process.env.REGEN_ROOT || process.env.LIFEAI_REPO_ROOT || "C:/Dev/regen-root";
|
|
202
|
+
// LIFEAI_ENV is the environment-harness checkout. A manifest that drives a
|
|
203
|
+
// service through a harness script (dev-center calls
|
|
204
|
+
// $LIFEAI_ENV/services/restart-dev-center.ps1) had no way to name it, so the
|
|
205
|
+
// literal token reached the shell and pwsh answered
|
|
206
|
+
// "not recognized as the name of a script file" with exit 64 — a restart that
|
|
207
|
+
// fails while the service stays up, which reads as a flaky action rather than
|
|
208
|
+
// an unresolved path.
|
|
209
|
+
const envRoot = process.env.LIFEAI_ENV || "C:/Dev/lifeai-env";
|
|
195
210
|
return String(value)
|
|
196
211
|
.replace(/\$\{REGEN_ROOT\}/g, root)
|
|
197
212
|
.replace(/\$REGEN_ROOT/g, root)
|
|
198
213
|
.replace(/%REGEN_ROOT%/gi, root)
|
|
199
214
|
.replace(/\$\{LIFEAI_REPO_ROOT\}/g, root)
|
|
200
215
|
.replace(/\$LIFEAI_REPO_ROOT/g, root)
|
|
201
|
-
.replace(/%LIFEAI_REPO_ROOT%/gi, root)
|
|
216
|
+
.replace(/%LIFEAI_REPO_ROOT%/gi, root)
|
|
217
|
+
.replace(/\$\{LIFEAI_ENV\}/g, envRoot)
|
|
218
|
+
.replace(/\$LIFEAI_ENV/g, envRoot)
|
|
219
|
+
.replace(/%LIFEAI_ENV%/gi, envRoot);
|
|
202
220
|
}
|
|
203
221
|
|
|
204
222
|
function normalizeLifecycleOwner(owner) {
|