fix(#2003): address code+security review findings
- warn (don't silently ignore) when --runtime is an unknown runtime that canonicalizeRuntimeName rejects; the warning surfaces via warnings[] so a typo like --runtime cluade or a runtime known to runtime-homes but not the alias manifest (e.g. grok) no longer silently resolves to the persisted runtime's config dir on this diagnostic command [M-1] - add end-to-end CLI test for loop render-hooks --runtime (the exact command the bug report calls out as silently no-op'ing) [L-2] - add closed-vocabulary rejection test: crafted --runtime values (../../etc/passwd, __proto__, --config-dir, garbage) are rejected, warn, and fall through to the persisted runtime — pins the security-load-bearing contract [NIT-01] - add boundary tests: --config-dir wins over --runtime (precedence); missing --runtime value errors with USAGE [N-1] Both orthogonal reviews returned APPROVE with no Critical/High findings. Security review confirmed --runtime cannot coerce getGlobalConfigDir into an arbitrary path (closed-vocabulary Map lookup + registry hash-key gate) and does not expand the trust surface beyond the existing operator-controlled --config-dir flag.
This commit is contained in:
@@ -477,6 +477,16 @@ function resolveCapabilityRuntimeState(
|
||||
const canonical = runtimeNamePolicy.canonicalizeRuntimeName(runtimeOverride);
|
||||
if (canonical) {
|
||||
resolvedConfigDir = runtimeHomes.getGlobalConfigDir(canonical);
|
||||
} else {
|
||||
// #2003: unknown runtime override — warn (don't silently ignore the
|
||||
// explicit input) and fall through to persisted-runtime resolution.
|
||||
// Avoids a silent-wrong-result on this diagnostic command for typos
|
||||
// (e.g. "cluade") or runtimes known to runtime-homes but not yet to
|
||||
// the alias manifest (e.g. "grok"). The warning surfaces via the
|
||||
// `warnings[]` channel consumed by cmdCapabilityState/cmdLoopRenderHooks.
|
||||
warnings.push(
|
||||
`--runtime "${runtimeOverride}" is not a known runtime; falling back to auto-detected/persisted runtime resolution`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!resolvedConfigDir) {
|
||||
|
||||
Reference in New Issue
Block a user