fix(security): harden runtime command override gating

This commit is contained in:
Peter Steinberger
2026-02-21 12:49:45 +01:00
parent cb84c537f4
commit fbb79d4013
12 changed files with 149 additions and 13 deletions

View File

@@ -62,6 +62,20 @@ describe("commands registry", () => {
expect(nativeDisabled.find((spec) => spec.name === "debug")).toBeFalsy();
});
it("does not enable restricted commands from inherited flags", () => {
const inheritedCommands = Object.create({
config: true,
debug: true,
bash: true,
}) as Record<string, unknown>;
const commands = listChatCommandsForConfig({
commands: inheritedCommands as never,
});
expect(commands.find((spec) => spec.key === "config")).toBeFalsy();
expect(commands.find((spec) => spec.key === "debug")).toBeFalsy();
expect(commands.find((spec) => spec.key === "bash")).toBeFalsy();
});
it("appends skill commands when provided", () => {
const skillCommands = [
{