security: fix command injection, XSS, prefix validation, cycle detection
- mcp_server.py: use shlex.quote() on all shell-interpolated values to prevent command injection via ticket title/description/human_id - corvid/router.py: add alphanumeric-only regex validation for environment prefix; add full ancestor cycle detection before setting parent_id; import re - Add SECURITY_REVIEW.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dd4eaa6f77
commit
0097055c15
3 changed files with 64 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ Configure in ~/.claude/mcp.json:
|
|||
"""
|
||||
|
||||
import os
|
||||
import shlex
|
||||
|
||||
import httpx
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
|
@ -68,7 +69,7 @@ def _generate_startup_script(ticket_id: int, human_id: str, title: str,
|
|||
f"Start by calling mcp__homelab-tickets__get_ticket({ticket_id}) to read the full "
|
||||
f"ticket details, then complete the work and mark the ticket as completed."
|
||||
)
|
||||
return f'claude "{prompt}" --allowedTools "{tools_str}"'
|
||||
return f'claude {shlex.quote(prompt)} --allowedTools {shlex.quote(tools_str)}'
|
||||
|
||||
|
||||
def _client() -> httpx.Client:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue