relay: serve installers that install from the relay serving them - #5
Merged
Conversation
A relay's /install.sh and /install.ps1 existed for people who cannot reach the upstream release page — but the scripts it served were the ones the release build baked, whose fallback base is that same unreachable page. The script downloaded fine and then stalled on its first request, and the only way through was an exported WANCTL_RELAY that nothing told the user about. The installers now carry a RELAY_SELF marker that the serving relay fills in with its own WANCTL_PUBLIC_ORIGIN, exactly as /skills already does with @WANCTL_RELAY@. The origin comes from the environment, never from request Host, and is rejected unless it is a plain http(s) origin free of characters that would stop being data once spliced into a shell or PowerShell script. A copy taken from the GitHub release page is unaffected, and WANCTL_RELAY and WANCTL_DIST_BASE still override. Installing from a mirror left `wanctl update` pointed back at the baked-in release page, with no way to change it short of exporting a variable per invocation: ReleaseBase() read the environment and the build default but skipped the config file every other setting resolves through. It now goes through Setting(), and release_base joins relay/portal/transport as a key `wanctl config set` accepts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCjgim6dZcTPZrhjk7fhkp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A relay's
/install.shand/install.ps1exist for people who cannot reach the upstream release page. But the scripts it served were the ones the release build baked, whose fallback base is that same unreachable page — so the script downloaded fine and then stalled on its first request. The only way through was an exportedWANCTL_RELAYthat nothing surfaced to the user.Second, installing from a mirror left
wanctl updatepointed back at the baked-in release page.ReleaseBase()read the environment and the build default but skipped the config file that every other setting resolves through, so there was no way to change it short of exporting a variable per invocation.Change
RELAY_SELFmarker that the serving relay fills in with its ownWANCTL_PUBLIC_ORIGIN— the same shape/skillsalready uses for@WANCTL_RELAY@. The origin comes from the environment, never from requestHost, and is rejected unless it is a plain http(s) origin free of characters that would stop being data once spliced into a shell or PowerShell script.ReleaseBase()now resolves throughSetting(), andrelease_basejoins relay/portal/transport as awanctl config setkey.selfhost/docker-compose.ymlalready passesRELAY_PUBLIC_ORIGINas a required value, so self-hosted deployments get this with no configuration change.Compatibility
A copy taken from the GitHub release page is unaffected —
RELAY_SELFis empty there and the baked release base still wins.WANCTL_RELAYandWANCTL_DIST_BASEstill override. An installer built before the marker existed is served untouched.Verification
Base resolution, checked under
dashon the rendered script:RELAY_SELFfilled)https://relay.example/dlhttps://release.example/downloadWANCTL_RELAYhttps://other.example/dlhttps://other.example/dlWANCTL_DIST_BASEhttps://explicit.example/xPlus new tests covering the rewrite for both installers, rejection of unsafe origins (quotes, backticks,
$(…), newline, non-http scheme), andrelease_basepersisting while still yielding to the environment. Full suite andgo vetpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01WCjgim6dZcTPZrhjk7fhkp