pr-tech-spec-generator
Fail
Audited by Gen Agent Trust Hub on Jun 16, 2026
Risk Level: HIGHCOMMAND_EXECUTION
Full Analysis
- [COMMAND_EXECUTION]: The script
scripts/generate_spec.pyusessubprocess.run(shell=True)through a wrapper functionrun_commandto executeghandgitcommands. - Vulnerable URL Parsing: In
parse_pr_url, the regular expressiongithub\.com/([^/]+)/([^/]+)/pull/(\d+)extracts the owner and repository name using a character class([^/]+)that allows shell metacharacters like;,&,|, and backticks. - Injection in PR View: The extracted owner and repo are interpolated directly into a shell command string in
fetch_pr_info:f'gh pr view {pr_number} --repo {owner}/{repo} ...'. A URL likegithub.com/owner;whoami/repo/pull/1would cause the shell to executewhoami. - Injection via PR Metadata: Branch names retrieved from the GitHub API (
baseRefNameandheadRefName) are used directly in shell commands withinget_git_diffandresolve_branch_ref. Specifically,run_command(f"git fetch origin {base_branch}:{base_branch}", ...)will execute arbitrary commands if a branch name contains shell metacharacters (e.g.,; rm -rf /). - Missing Sanitization: There is no evidence of shell escaping (e.g., using
shlex.quote) or the use of argument lists instead of raw shell strings, which is the primary cause of these vulnerabilities.
Recommendations
- AI detected serious security threats
Audit Metadata