can1357/oh-my-pi · error · HTTPException
remote url must not start with '-'
Error message
remote url must not start with '-'
What it means
A remote URL beginning with '-' is rejected with HTTP 400. Leading dashes make the value look like a command-line option to git (option/argument confusion), so the proxy refuses any URL whose first character is '-' before it is ever passed to a git command.
Source
Thrown at python/robomp/src/proxy/server.py:346
raise HTTPException(400, f"remote url host must be github.com for repo {expected_repo!r}")
if parsed.params or parsed.query or parsed.fragment:
raise HTTPException(400, "remote url must not contain params, query, or fragment")
path = parsed.path.strip("/")
if path.endswith(".git"):
path = path[:-4]
if path.lower() != expected_repo.lower():
raise HTTPException(400, f"remote url does not match repo {expected_repo!r}")
return _github_url_for_repo(expected_repo)
def _remote_auth_for_url(url: str, expected_repo: str, token: str) -> _RemoteAuth:
raw = url.strip()
if not raw or raw != url:
raise HTTPException(400, "remote url must not be empty or padded")
if _FORBIDDEN_URL_BYTES_RE.search(raw):
raise HTTPException(400, "remote url contains forbidden control bytes")
if raw.startswith("-"):
raise HTTPException(400, "remote url must not start with '-'")
if _REMOTE_HELPER_RE.match(raw):
raise HTTPException(400, "git remote helper transports are disabled")
scheme = (urlparse(raw).scheme or "").lower()
if scheme in ("http", "https"):
normalized = _normalized_github_https_url(raw, expected_repo)
return _RemoteAuth(url=normalized, token=token, auth_url=normalized)
return _RemoteAuth(url=raw, token=None, auth_url=None)
def _clone_remote_auth(clone_url: str, expected_repo: str, token: str) -> _RemoteAuth:
try:
return _remote_auth_for_url(clone_url, expected_repo, token)
except HTTPException:
log.warning(
"gh-proxy: refusing clone — clone_url is not permitted",
extra={"expected_repo": expected_repo},
)
raiseView on GitHub (pinned to 9690622007)
Solutions
- Ensure the value is a real URL (scheme://...) not a git flag
- Strip or reject leading-dash input at the caller before calling the proxy
- If using untrusted input, validate the URL starts with an allowed scheme like https://
Example fix
// before
const target = "--upload-pack=evil";
// after
if (!/^https?:\/\//.test(target)) throw new Error("expected URL, got: " + target); Defensive patterns
Strategy: validation
Validate before calling
if (url.startsWith("-")) throw new Error("remote url must not start with '-'"); Type guard
function isUrlLike(u: unknown): u is string {
return typeof u === "string" && /^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(u);
} Prevention
- Validate URLs start with an explicit scheme (https://, ssh://)
- Keep flag arguments and URL values in separate variables/fields
- Treat all remote URL fields as git-argument-sensitive input
When it happens
Trigger: Passing a value like '--upload-pack=evil' or '-foo' as the remote/repo URL to an endpoint that resolves to _clone_remote_auth or _origin_remote_auth.
Common situations: Malicious input probing git option injection; accidental paste of a flag into a URL field; templating bugs where a flag variable is substituted into the URL slot.
Related errors
- invalid workspace_key {workspace_key!r}
- remote url contains forbidden control bytes
- git remote helper transports are disabled
- The managed-skills root is a symlink; refusing to operate ou
- Managed skill "${name}" SKILL.md is a symlink; refusing to o
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/c17bde12232e8736.
Report an issue: GitHub.