fix(agent): isolate conversation workspaces
Generic Container CI/CD / test-build-publish (push) Successful in 2m2s
Agent CI/CD v2 / build-test-publish-and-deploy (push) Successful in 2m2s

This commit is contained in:
2026-08-25 13:18:39 +08:00
parent 004c9bb72d
commit ce04704af2
18 changed files with 621 additions and 48 deletions
+38
View File
@@ -129,4 +129,42 @@ describe("permission approval policy", () => {
title: "已按始终允许模式放行",
});
});
it.each([
"rm -rf ./target",
"rm -rf ./target",
"rm -Rf ./target",
"/bin/rm -rf ./target",
"command rm --force --recursive ./target",
"env LANG=C rm -r -f ./target",
"SAFE=1 rm -rf ./target",
"env -u HOME rm -rf ./target",
"r\"\"m -rf ./target",
"(rm -rf ./target)",
"! rm -rf ./target",
"npm test && rm --recursive --force ./target",
])("rejects direct recursive force removal in always mode: %s", (command) => {
expect(
resolvePermissionApproval("always", "bash", {
metadata: { command },
patterns: [command],
}),
).toMatchObject({
autoApprove: false,
autoReject: true,
title: "已拒绝递归强制删除",
});
});
it.each(["rm tmp.txt", "rm -f tmp.txt", "rm -r tmp-dir", "echo 'rm -rf tmp'"])(
"keeps non-recursive or non-executed removal text available for confirmation: %s",
(command) => {
expect(
resolvePermissionApproval("always", "bash", {
metadata: { command },
patterns: [command],
}),
).toMatchObject({ autoApprove: false, autoReject: false });
},
);
});