Skip to content

Commit 93ed58a

Browse files
committed
test(permissions): drop alias-presenting grant tests
Live requests never present as aliases (coerced before matching), so tests presenting update_plan requests exercise an unreachable path. Fail-closed pins and seeder tests remain.
1 parent 9d6c6b4 commit 93ed58a

3 files changed

Lines changed: 7 additions & 39 deletions

File tree

‎src/agent/canonical-tool-name.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export function canonicalToolName(requested: string): string {
3232
// a stored manage_tasks (engine) grant covers update_plan use, but a stored
3333
// update_plan grant covers only update_plan-presenting requests — never a
3434
// manage_tasks request, which may carry update/cancel payloads the operator
35-
// never approved.
35+
// never approved. The update_plan-presenting allowance is unreachable live
36+
// (requests are post-coercion and seeders drop stored update_plan keys); it
37+
// exists only so direct match-API callers keep narrow-narrow coverage.
3638
export function grantToolCovers(
3739
storedTool: string,
3840
requestTool: string,

‎src/agent/tool-aliases.test.ts‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ describe("grant aliases", () => {
125125
// todo/doing/done statuses, while manage_tasks spans the full lifecycle
126126
// (create/update, including cancelled). Grant coverage is one-directional:
127127
// a stored update_plan grant must never cover a manage_tasks request.
128+
// Live requests never present as aliases (coerced before matching) and
129+
// seeders drop stored update_plan keys, so no same-alias replay test exists
130+
// here: that path is unreachable in production.
128131
test("a stored update_plan grant does not cover manage_tasks", async () => {
129132
expect(
130133
await evaluateApprovals({
@@ -136,26 +139,7 @@ describe("grant aliases", () => {
136139
).toBe(false);
137140
});
138141

139-
test("a stored update_plan grant still covers update_plan (create-equivalent) use", async () => {
140-
expect(
141-
await evaluateApprovals({
142-
tool: "update_plan",
143-
subject: "update_plan",
144-
approvals: [{ tool: "update_plan", pattern: "*" }],
145-
workspace: noWorkspace,
146-
}),
147-
).toBe(true);
148-
});
149-
150-
test("a stored manage_tasks grant covers update_plan (engine covers alias)", async () => {
151-
expect(
152-
await evaluateApprovals({
153-
tool: "update_plan",
154-
subject: "update_plan",
155-
approvals: [{ tool: "manage_tasks", pattern: "*" }],
156-
workspace: noWorkspace,
157-
}),
158-
).toBe(true);
142+
test("a stored manage_tasks grant covers manage_tasks", async () => {
159143
expect(
160144
await evaluateApprovals({
161145
tool: "manage_tasks",

‎src/permission/grant-scope.test.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ describe("grant tool/providerModel/cwd scoping agrees across call sites", () =>
4343
{ tool: "run_shell", cwd: undefined, activeProviderModel: undefined },
4444
{ tool: "write_file", cwd: "/proj", activeProviderModel: undefined },
4545
{ tool: "manage_tasks", cwd: "/proj", activeProviderModel: undefined },
46-
{ tool: "update_plan", cwd: "/proj", activeProviderModel: undefined },
4746
];
4847

4948
for (const grant of grants) {
@@ -107,23 +106,6 @@ describe("grant tool/providerModel/cwd scoping agrees across call sites", () =>
107106
}),
108107
).toBe(false);
109108
});
110-
111-
test("stored manage_tasks grant covers an update_plan-presenting request", async () => {
112-
const grant: Approval = { tool: "manage_tasks", pattern: "*" };
113-
expect(
114-
grantScopeMatches(grant, "update_plan", undefined, "/proj", workspace),
115-
).toBe(true);
116-
expect(
117-
await approvalCoversSubject({
118-
tool: "update_plan",
119-
subject: "update_plan",
120-
approvals: [grant],
121-
activeProviderModel: undefined,
122-
requestCwd: "/proj",
123-
workspace,
124-
}),
125-
).toBe(true);
126-
});
127109
});
128110

129111
// Seeded grants enter the gate in native key space. Pure renames collapse onto

0 commit comments

Comments
 (0)