mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
refactor(permission-system): simplify policy and autoreview flow
This commit is contained in:
@@ -154,35 +154,6 @@ describe("shell-tool alias gating (#574)", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("gates an aliased tool's workdir and its relative tokens via external_directory", async () => {
|
||||
const { handler, events } = makeHandler({
|
||||
shellTools: execShellTools,
|
||||
tools: ["exec_command"],
|
||||
session: {
|
||||
checkPermission: makeSurfaceCheck(
|
||||
{ external_directory: { state: "deny", matchedPattern: "*" } },
|
||||
{ state: "allow" },
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
// workdir /etc is outside the cwd; the relative token resolves against it.
|
||||
await handler.handleToolCall(
|
||||
makeToolCallEvent("exec_command", {
|
||||
input: { cmd: "cat ../secret.txt", workdir: "/etc" },
|
||||
}),
|
||||
makeCtx(),
|
||||
);
|
||||
|
||||
const decisions = getDecisionEvents(events);
|
||||
expect(decisions).toContainEqual(
|
||||
expect.objectContaining({
|
||||
surface: "external_directory",
|
||||
result: "deny",
|
||||
resolution: "policy_deny",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("floors an indirection wrapper (sudo) in an aliased command to ask (#490)", async () => {
|
||||
const { handler, events } = makeHandler({
|
||||
|
||||
Reference in New Issue
Block a user