odysseus-dev/odysseus · error · ValueError
invalid ssh port
Error message
invalid ssh port
What it means
Error "invalid ssh port" thrown in odysseus-dev/odysseus.
Source
Thrown at routes/shell_routes.py:90
def _reject_cross_site(request: Request):
"""Reject browser cross-site navigations to shell-touching endpoints."""
if request.headers.get("sec-fetch-site") == "cross-site":
raise HTTPException(403, "Cross-site request rejected")
_SSH_PORT_RE = re.compile(r"^\d{1,5}$")
_SAFE_VENV_RE = re.compile(r"^[A-Za-z0-9_./~-]+$")
def _ssh_base_argv(host: str, ssh_port: str | None) -> list[str]:
"""Build an ssh argv prefix for remote probes without local-shell parsing."""
if not host or not str(host).strip() or str(host).lstrip().startswith("-"):
raise ValueError("invalid ssh host")
argv = ["ssh", "-o", "ConnectTimeout=6", "-o", "StrictHostKeyChecking=no"]
if ssh_port and str(ssh_port).strip() not in ("", "22"):
port = str(ssh_port).strip()
if not _SSH_PORT_RE.match(port) or not (1 <= int(port) <= 65535):
raise ValueError("invalid ssh port")
argv += ["-p", port]
argv.append(str(host).strip())
return argv
def _venv_activate_prefix(venv: str | None) -> str:
"""Return a remote activation prefix while preserving shell expansion of ~."""
if not venv:
return ""
if not _SAFE_VENV_RE.match(venv):
raise ValueError("invalid venv path")
act = venv if venv.endswith("/bin/activate") else venv.rstrip("/") + "/bin/activate"
return f". {act} && "
logger = logging.getLogger(__name__)
PTY_SUPPORTED = pty is not None and fcntl is not None and hasattr(os, "setsid")View on GitHub (pinned to f9235ebbf1)
Solutions
- Enter a port number between 1 and 65535.
- Leave the port empty to use the SSH default of 22.
When it happens
Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.
Common situations: See trigger scenarios.
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/128cc60ffa9f7076.
Report an issue: GitHub.