Skip to content

Allowlist the Galaxy host in the bash sandbox when GALAXY_URL is scheme-less#365

Draft
dannon wants to merge 2 commits into
galaxyproject:mainfrom
dannon:fix/297-sandbox-galaxy-host
Draft

Allowlist the Galaxy host in the bash sandbox when GALAXY_URL is scheme-less#365
dannon wants to merge 2 commits into
galaxyproject:mainfrom
dannon:fix/297-sandbox-galaxy-host

Conversation

@dannon

@dannon dannon commented Jun 26, 2026

Copy link
Copy Markdown
Member

Closes #297.

buildSandboxConfig derives the bash sandbox's network allowlist from the Galaxy host, but hostFromUrl fed process.env.GALAXY_URL straight into new URL(). A scheme-less configured URL like usegalaxy.org throws there, the error is swallowed, and the Galaxy host never lands in the allowlist -- the same scheme-less-URL class that bit the REST path in #264/#290.

The fix runs the URL through normalizeGalaxyUrl first -- the existing helper /connect and the profile system already use -- so a bare host resolves to https://usegalaxy.org exactly the way the connection does. The allowlisted host is therefore the one Galaxy actually talks to, never broader.

While in here, an adversarial review of the diff pointed out that a non-http(s) GALAXY_URL (ftp://x.org, file://host/...) would still hand a host to the allowlist. Galaxy speaks http(s) only (validateGalaxyUrl enforces this on connect), so the host is now kept only for http:/https:. That tightens the allowlist relative to the old behavior rather than broadening it.

Low impact in practice -- Galaxy work flows over MCP, not bash, so the tight default was mostly fine -- but it closes the gap consistently.

Test-first: extended tests/sandbox-config.test.ts with the scheme-less case (the host gets allowlisted) alongside the existing scheme-ful case, plus loopback-http, non-http(s)-scheme, and empty-input coverage. Root npm test (1255 pass) and the app typecheck are green.

dannon added 2 commits June 26, 2026 15:18
…me-less

hostFromUrl fed the raw GALAXY_URL straight into new URL(), which throws on a
bare host like "usegalaxy.org", so the Galaxy host never made it into the
sandbox's network allowlist. Run it through normalizeGalaxyUrl first -- the same
helper /connect and the profile system use -- so a scheme-less host resolves the
same way the connection does, and the allowlisted host is exactly the one Galaxy
talks to. While here, only keep the host for http(s) so an ftp:// or
file://host/ URL can't seed the allowlist; Galaxy is http(s) only anyway.
Fold the whitespace-only case into the existing junk test -- the empty-string
assert just re-covered the !url guard that undefined already exercises -- and
trim the protocol-gate comment down to the why.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bash sandbox doesn't allowlist the Galaxy host when GALAXY_URL is scheme-less

1 participant