fix: deny bash tool for prometheus agent (#2273)#2298
fix: deny bash tool for prometheus agent (#2273)#2298guazi04 wants to merge 1 commit intocode-yeongyu:devfrom
Conversation
Prometheus's prometheus-md-only hook only blocks Write/Edit tools, but bash commands (cp, rm, python3 -c, etc.) can bypass file restrictions. This adds bash and interactive_bash to the deny list in tool-config-handler. - Added bash: deny and interactive_bash: deny to Prometheus tool permissions - Added 4 new tests covering the deny behavior
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: The changes are narrowly scoped to the Prometheus agent and include comprehensive tests verifying that other agents are unaffected, ensuring no regressions.
|
Thank you for the detailed investigation and well-structured PR. However, this approach is not the right fix for the issue. ContextAfter reviewing the original issue (#2273) and the design intent:
Why This PR Is IncorrectDenying bash tools entirely would break Prometheus's intended functionality. Prometheus needs bash to:
The Recommended ApproachThe fix should be in the
Option A is more robust but more complex. Option B relies on agent behavior but is simpler. SuggestionThe |
|
@acamq Thanks for the detailed feedback on this PR. I went ahead and implemented Option A in #2403 — a bash command analyzer with allowlisted read-only commands and a custom tokenizer. After two rounds of automated review (cubic) and significant iteration, I've come to believe Option A is fundamentally untenable. Here's why: The tokenizer approach has a ceilingThe current implementation is 424 lines of hand-written bash tokenizer + command policy. After fixing the first round of issues, cubic's second review found 8 more bypasses (4× P0 security):
Each fix introduces new edge cases. Bash syntax is effectively Turing-complete — a regex/tokenizer-based policy will always have gaps. This isn't a matter of writing better code; it's a fundamental limitation of the approach. Proposal: Option C — Replace bash with existing read-only toolsPrometheus needs bash for one thing: inspecting the codebase. But we already have purpose-built read-only tools that do this better:
This is already proven. Oracle, Librarian, and Explore are all read-only agents that operate without bash — and they work great. Prometheus would follow the same pattern. The implementation would be minimal: deny I'd like to hear your thoughts before continuing work on #2403. If Option C is acceptable, I can update that PR accordingly. |
Summary
Closes #2273
Problem: Prometheus's
prometheus-md-onlyhook only blocksWriteandEdittools, but bash commands (cp,rm,python3 -c, etc.) can bypass file restrictions entirely.Fix: Added
bash: "deny"andinteractive_bash: "deny"to Prometheus's tool permissions intool-config-handler.ts.Changes
src/plugin-handlers/tool-config-handler.ts— Added bash and interactive_bash deny rules to Prometheus agent permissionssrc/plugin-handlers/tool-config-handler.test.ts— Added 4 new tests verifying the deny behavior for both toolsTesting
bashtool denied for Prometheusinteractive_bashtool denied for PrometheusSummary by cubic
Deny bash and interactive_bash tools for the Prometheus agent to enforce prometheus-md-only and stop shell command bypasses (cp, rm, python3 -c). Other agents are unaffected; non-denied tools still work for Prometheus.
Written for commit 403efd7. Summary will update on new commits.