abhigyanpatwari/GitNexus · error · SandboxError
model base URL must be an HTTP(S) endpoint without credentia
Error message
model base URL must be an HTTP(S) endpoint without credentials, query, or fragment
What it means
Raised by _validated_base_url when a model base URL is not a clean HTTP(S) endpoint. The validator (urlsplit) requires scheme http/https, a non-empty hostname, and no username, password, query, or fragment. This prevents credentials leaking into the URL, ambient query params, or fragment tricks reaching the model endpoint inside the sandbox.
Source
Thrown at eval/workflow_bench/proposer_sandbox.py:257
path.chmod(0o600)
except BaseException:
shutil.rmtree(destination, ignore_errors=True)
raise
return destination
def _validated_base_url(base_url: str) -> str:
value = base_url.strip()
parsed = urlsplit(value)
if (
parsed.scheme not in {"http", "https"}
or not parsed.hostname
or parsed.username is not None
or parsed.password is not None
or parsed.query
or parsed.fragment
):
raise SandboxError("model base URL must be an HTTP(S) endpoint without credentials, query, or fragment")
return value
def build_sandbox_environment(
*,
auth_token: str | None = None,
base_url: str | None = None,
) -> dict[str, str]:
"""Build the entire parent environment; never copy ``os.environ``."""
env = {
"HOME": SANDBOX_HOME,
"USER": "agent",
"LOGNAME": "agent",
"TMPDIR": SANDBOX_TMP,
"XDG_CONFIG_HOME": f"{SANDBOX_HOME}/.config",
"XDG_CACHE_HOME": f"{SANDBOX_HOME}/.cache",
"XDG_STATE_HOME": f"{SANDBOX_HOME}/.local/state",View on GitHub (pinned to d540b00184)
Solutions
- Strip credentials out of the URL and pass the token via auth_token instead.
- Remove query and fragment; move any needed params into headers/body at the call site.
- Ensure the scheme is exactly http or https and a hostname is present.
- For local mock servers use http://127.0.0.1:PORT with no extras.
Example fix
// before build_sandbox_environment(base_url='https://user:pass@api.example.com?beta=1#x') // after build_sandbox_environment(auth_token='pass', base_url='https://api.example.com')
Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlsplit
def is_clean_http_url(url: str) -> bool:
p = urlsplit(url.strip())
return (p.scheme in {'http','https'}
and bool(p.hostname)
and p.username is None
and p.password is None
and not p.query
and not p.fragment)
if not is_clean_http_url(base_url):
raise ValueError(f'invalid base_url: {base_url!r}') Type guard
from urllib.parse import urlsplit
def is_clean_http_endpoint(url: object) -> bool:
if not isinstance(url, str):
return False
p = urlsplit(url.strip())
return (p.scheme in {'http','https'}
and bool(p.hostname)
and p.username is None
and p.password is None
and not p.query
and not p.fragment) Try / catch
try:
env = build_sandbox_environment(auth_token=tok, base_url=base_url)
except SandboxError as exc:
if 'HTTP(S) endpoint' in str(exc):
base_url = strip_userinfo_query_fragment(base_url)
env = build_sandbox_environment(auth_token=tok, base_url=base_url)
raise Prevention
- Keep credentials out of URLs; pass tokens via auth_token.
- Validate base_url with urlsplit at config load.
- Reject query/fragment in endpoint config.
- Use http(s)://host[:port] only.
When it happens
Trigger: Passing base_url to build_sandbox_environment with a non-http(s) scheme (file://, unix://), a URL with embedded user:pass@host, a URL carrying ?query or #fragment, or a URL with no hostname (e.g. 'http:///path').
Common situations: base_url read from an env var or config that included an API key as userinfo; a proxy URL with ?api_key=... in the query string; mistyped scheme (htps); localhost-with-port URLs that accidentally carried a fragment from a docs page; file:/// or mock-server URL used in tests.
Related errors
- Refusing to start eval-server on non-loopback host ${host} w
- {label} must be a real non-symlink directory: {path}
- {label} contains an unsafe path component: {relative}
- {label} must be a regular non-symlink file: {path}
- {label} changed while opening: {path}
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/afd5f8ecdfbcf68b.
Report an issue: GitHub.