fix: keep a disabled CLI's keys in the owner env clamp (release review)

ownerClampedEnvKeys() read enabledClis(), so disabling a CLI dropped its
privileged keys from the clamp, and a revoked owner got a saved home back on
recovery or reboot restore. getCli() still returns a disabled entry, and a
session can outlive the switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-06 02:39:11 +01:00
1 parent db5222c4fa
commit 4513ef6ebb
2 files changed
+38 -2

No files matched your search

+3 -2
View File
@@ -32,7 +32,7 @@
*/
import { canUsernameRunPrivilegedCommands } from './user-store.js';
import { enabledClis } from './config/cli-registry/registry.js';
import { listClis } from './config/cli-registry/registry.js';
/**
* Env-var keys a non-granted owner must not be able to set, because each one
@@ -68,7 +68,8 @@ import { enabledClis } from './config/cli-registry/registry.js';
* already allowlisted for pi and not addressed here — see resolveOmpHome()).
*/
export function ownerClampedEnvKeys(): string[] {
return enabledClis().flatMap((entry) => entry.capabilities.privilegedEnvKeys);
// Every CLI, enabled or not: a session can outlive the switch that disabled its CLI.
return listClis().flatMap((entry) => entry.capabilities.privilegedEnvKeys);
}
/**