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
+14
View File
@@ -106,6 +106,20 @@ export function createPrometheusMdOnlyHook(ctx: PluginInput) {
return
}
// Block bash commands completely - Prometheus is read-only
if (toolName === "bash") {
log(`[${HOOK_NAME}] Blocked: Prometheus cannot execute bash commands`, {
sessionID: input.sessionID,
tool: toolName,
agent: agentName,
})
throw new Error(
`[${HOOK_NAME}] ${getAgentDisplayName("prometheus")} cannot execute bash commands. ` +
`${getAgentDisplayName("prometheus")} is a READ-ONLY planner. Use /start-work to execute the plan. ` +
`APOLOGIZE TO THE USER, REMIND OF YOUR PLAN WRITING PROCESSES, TELL USER WHAT YOU WILL GOING TO DO AS THE PROCESS, WRITE THE PLAN`
)
}
const filePath = (output.args.filePath ?? output.args.path ?? output.args.file) as string | undefined
if (!filePath) {
return