Add dynamic model assignment with security hardening#3
Open
churcho wants to merge 6 commits intodanpeg:mainfrom
Open
Add dynamic model assignment with security hardening#3churcho wants to merge 6 commits intodanpeg:mainfrom
churcho wants to merge 6 commits intodanpeg:mainfrom
Conversation
Each role can now run on Claude, Codex CLI, or Gemini CLI via --preset and --hunter/--skeptic/--referee flags. Defaults to all-Claude for backward compatibility.
Add dynamic model assignment for bug hunt roles
…g hunt - Pass all external CLI prompts via stdin/tempfile instead of inline shell interpolation (fixes shell injection risk) - Use mktemp for unique temp files per run (fixes concurrent collisions) - Add provider validation with clear error on invalid values - Add target path existence check before dispatching agents - Add Hunter success gate before proceeding to Skeptic/Referee - Fix codex CLI invocation to use stdin mode (codex exec -) - Fix malformed markdown link in README
Fix security and robustness issues found by bug hunt
Keep both the branch diff mode docs from upstream and the dynamic model assignment section from the fork.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This PR adds dynamic model assignment to bug-hunt, letting users run Hunter, Skeptic, and Referee on different AI providers (Claude, Codex CLI, Gemini CLI). It also fixes several security and robustness issues discovered by running bug-hunt on itself with mixed providers.
Dynamic model assignment (SKILL.md, README.md)
Users can now assign providers per role via CLI flags:
Presets provide named configurations:
claude(default) — all three roles run as Claude Code subagents, identical to current behaviorcodex— all roles shell out to Codex CLIgemini— all roles shell out to Gemini CLImixed— Hunter=Codex, Skeptic=Claude, Referee=GeminiIndividual
--hunter=,--skeptic=,--referee=flags override any preset. With no flags, behavior is unchanged from the original (all Claude).Provider dispatch:
mktemp) and pipe it via stdin to the CLI (codex exec -/gemini -p -)Security and robustness fixes (found by self-scan)
After implementing model assignment, we ran
/bug-hunt --hunter=codex --skeptic=claude --referee=codexon this repo. The adversarial review confirmed 7 real issues, all now fixed:Critical — shell injection (BUG-1, BUG-2):
The original external CLI instructions interpolated scan targets and report content directly into shell command strings. A path like
src; rm -rf /or report text containing shell metacharacters could execute arbitrary commands. Fixed by always passing prompt content via stdin/temp file, never inlining into shell args.Medium — tempfile collisions (BUG-3):
The hard-coded path
/tmp/bug-hunt-hunter-prompt.mdwould corrupt concurrent runs. Fixed withmktemp /tmp/bug-hunt-{role}-XXXXXX.mdfor unique files per invocation, with cleanup after use.Medium — no provider validation (BUG-4):
Invalid provider values (e.g.,
--hunter=gpt4) were silently accepted with undefined dispatch behavior. Step 0 now validates all provider values and stops with a clear error on invalid input.Medium — no Hunter success gate (BUG-18):
If the Hunter agent failed (CLI not installed, crash, empty output), the flow continued to Skeptic/Referee with no input. Step 2b now explicitly verifies Hunter success before proceeding.
Low — no target validation (BUG-9):
Specifying a nonexistent scan target would dispatch agents that fail confusingly downstream. Step 0 now checks target existence and fails fast with a clear message.
Low — malformed markdown link (BUG-11):
The
@systematiclsattribution link in README.md used nested markdown syntax[text]([url](url)). Fixed to a single valid link.Codex CLI invocation fix:
The original instructions used
codex exec "prompt"which doesn't work for theexecsubcommand. Corrected tocat file | codex exec -(stdin mode).Files changed
SKILL.md— argument parsing, provider validation, target validation, external CLI dispatch via stdin, Hunter success gateREADME.md— dynamic model assignment docs, provider table, fixed markdown linkNo changes to the prompt files (hunter.md, skeptic.md, referee.md).
Backward compatibility
Running
/bug-huntor/bug-hunt src/with no provider flags behaves identically to the current version. All three roles default to Claude Code subagents. The new functionality is additive.How I tested
/bug-hunt --hunter=codex --skeptic=claude --referee=codexon this repo itself — Hunter (Codex gpt-5.3) found 20 issues, Skeptic (Claude) challenged them down to 4, Referee (Codex) confirmed 7. All confirmed bugs are fixed in this PR.codex exec -)Checklist
/bug-hunt