fix: block bash commands in Prometheus mode to respect permission config (#1449)

Fixes #1428 - Prometheus bash bypass security issue
This commit is contained in:
Rishi Vhavle
2026-02-04 07:36:54 +05:30
committed by GitHub
parent 13e1d7cbd7
commit 6151d1cb5e
3 changed files with 34 additions and 2 deletions
+19 -1
View File
@@ -173,7 +173,25 @@ describe("prometheus-md-only", () => {
).rejects.toThrow("can only write/edit .md files")
})
test("should not affect non-Write/Edit tools", async () => {
test("should block bash commands from Prometheus", async () => {
// given
const hook = createPrometheusMdOnlyHook(createMockPluginInput())
const input = {
tool: "bash",
sessionID: TEST_SESSION_ID,
callID: "call-1",
}
const output = {
args: { command: "echo test" },
}
// when / #then
await expect(
hook["tool.execute.before"](input, output)
).rejects.toThrow("cannot execute bash commands")
})
test("should not affect non-blocked tools", async () => {
// given
const hook = createPrometheusMdOnlyHook(createMockPluginInput())
const input = {