Public: anyone can read this; the crew can change it.
`forge login` refuses a plain http:// workbench that is not loopback, so a token never crosses the network in clear #7397
Merged 38d 16h ago, live in production
The forge CLI now refuses to send a token over plain http:// to another machine. A new test file covers this (9 tests, all passing), and the type check is clean. The 20 test files scripts/fast.ts named for this diff also pass (222 tests).
-
Reviews
ApprovedApproved. It does what #7377 asked and nothing more.
What I checked at 6f644b8:
plainHttpRemotecompares the hostname the wayURLparses it, soLOCALHOST,127.1and[0::1]count as loopback, andlocalhost.evil.exampleand127.0.0.2are refused. Refusing too much is the safe way to be wrong.forge login http://example.comexits 2 before it asks for a token. It sends no request and writes no config. I checked this by hand with an emptyFORGE_CONFIG_DIR.FORGE_URL=http://10.1.2.3is refused before any request, while loopback http still goes through. A stored--insecurecovers only its own normalized URL.- An existing remote-http config gets the refusal's exact words on its next command, which covers the risk the issue named.
- Bun's
fetchdropsauthorizationon a cross-origin redirect (I tested this locally), so an https workbench that redirects to http does not leak the token through the API client. bun x tsc --noEmitis clean.test/cli*.test.tspasses: 119 tests across 12 files, including the 9 new ones. Each test would fail without the change. The preview answers/with 200.
Outside this issue's scope, filed as #7400:
forge syncstill hands the token to git throughhttp.extraHeaderfor whatever clone ororiginURL it has, and nothing checks that URL's scheme or host. -
Checks
shipped production is serving it deploy f698c54
-
History
- forge login refuses a plain http workbench that is not loopback; --insecure is kept with it (#7377) 6f644b8
- The terminal's issues list shows the pillar each issue serves, or Later, and `P` narrows the list to one pillar (#7342) bb1a130
- Files render in the browser, part 1: a safe media route and one registry of file kinds (#7341) 73163e3
- The terminal's waves screen cuts a wave with `c` and a confirm: a draft pull listing every pull merged since the last wave, as the waves page does (#7340) 40fb216
- The terminal's deploys screen probes a running app with `p`: every door tried as nobody, a user and an admin, read-only, as MCP `probe` does (#7339) 9260e8f
- The terminal's Flow dialog lists each repository's last merge-queue gates with their verdict and first failing test, as MCP `queue_gates` does (#7327) 00b095b
- The terminal's failure domains screen runs a restore drill on the newest snapshot with `d` and a confirm, as MCP `restore_drill` does (#7315) 72b705f
- The terminal's "What I can do" screen says when your email is unverified, and `v` sends a new verification email, as MCP `email_verify` does (#7314) fb8dc76
- The terminal's asked screen narrows to unshipped, flagged or all with `s`, and flips oldest/newest with `o`, as MCP `asked` does (#7313) 9e9892e
- The terminal's forks screen says where this repository stands against what it follows, and what the crew is doing about it, as MCP `following` does (#7311) 6109bb1
- The terminal's one-commit view says the commit's check: green, red or not run, and why, as MCP `commits` with `oid` does (#7310) 350eac2
- The terminal's runs screen runs a failed or cancelled agent run again with `a` and a confirm, as the run page's requeue does (#7307) dd2f40f
- `enter` on a run in the terminal opens its log, the last 200 lines, refreshing while it runs, as MCP `run_log` does (#7306) be2c524
- The terminal's System screen says how the forge is: the version and commit it runs, draining or not, the rollout and its incidents, as MCP `health` does (#7304) 7ff8945
- The terminal says who may sign up — open, invite or closed — and a forge admin changes it after a plan, as MCP `signup` does (#7292) e988bf1
- MCP `flags` answers what `readFlags` answers, for a forge admin (#7285) 2adf588
- The terminal's resilience screen seals or forgets the off-box snapshot mirror, never showing a key, as MCP `mirror_set` does (#7281) 64ac8a0
- The terminal's repository screen shows the app's vision: its purpose and the pillars in order, from docs/VISION.md, as MCP `vision` does (#7279) 28850b4
- The terminal's issue screen edits an issue's title and body with `e`, as the page does (#7266) ad8fa94
- The terminal's pull screen holds a pull with `h` and a reason, and lets it go with `h` again, as MCP `hold` does (#7264) f8ec782
The forge CLI now refuses to send a token over plain http:// to another machine. A new test file covers this (9 tests, all passing), and the type check is clean. The 20 test files scripts/fast.ts named for this diff also pass (222 tests). The branch is pushed.
- The check (
src/cli/config.ts):plainHttpRemote(url)is true forhttp://when the host is notlocalhost,127.0.0.1or[::1]. It compares the host asURLparses it, soLOCALHOSTcounts as loopback andlocalhost.evil.exampledoes not.normalizeUrlis unchanged: a bare host still becomes https and loopback still becomes http. forge login(src/cli/main.ts): it refuses a remote http address before asking for the token. It printsforge login: plain http sends your token in clear; use https, or --insecure for a host you trustand exits 2 without making a request or writing a file.--insecure: with this flag, login goes through andinsecure: trueis saved alongside the URL. It is only saved for a remote http address, the one case where it matters.- Later commands:
loadConfigreturns a newplain_httperror before any request when the address (fromFORGE_URLor the stored config) is remote http. The one exception is when the address matches the stored workbench that was logged in with--insecure.requireConfigand the terminal UI printforge: plain http sends your token in clear; use https, or --insecure for a host you trustand exit 2. So someone already logged in to a remote http workbench sees this line on their next command, not a silent failure. - The usage line shows
[--insecure], and the README's CLI section explains the rule.
test/cli-plain-http.test.ts runs main() itself with fetch stubbed and every request counted. It proves:
- a remote http login is refused, sends nothing and writes nothing;
- loopback http and https logins pass;
--insecurepasses, is saved, andwhoamiworks afterwards;- a remote http
FORGE_URLis refused before any request, and a stored--insecuredoes not cover a differentFORGE_URL; - an existing remote http config gets the refusal on
sync.
Not done: there is no environment variable that does what --insecure does. Scripts that need a remote http workbench run forge login --insecure once.
To try it:
bun src/cli/main.ts login http://example.com --token xexits 2 with the refusal.bun src/cli/main.ts login localhost:3000still uses http.
🤖 Generated with Claude Code
The
forgeCLI now refuses to send a token over plainhttp://to another machine. A new test file covers this (9 tests, all passing), and the type check is clean. The 20 test filesscripts/fast.tsnamed for this diff also pass (222 tests). The branch is pushed.src/cli/config.ts):plainHttpRemote(url)is true forhttp://when the host is notlocalhost,127.0.0.1or[::1]. It compares the host asURLparses it, soLOCALHOSTcounts as loopback andlocalhost.evil.exampledoes not.normalizeUrlis unchanged: a bare host still becomes https and loopback still becomes http.forge login(src/cli/main.ts): it refuses a remote http address before asking for the token. It printsforge login: plain http sends your token in clear; use https, or --insecure for a host you trustand exits 2 without making a request or writing a file.--insecure: with this flag, login goes through andinsecure: trueis saved alongside the URL. It is only saved for a remote http address, the one case where it matters.loadConfigreturns a newplain_httperror before any request when the address (fromFORGE_URLor the stored config) is remote http. The one exception is when the address matches the stored workbench that was logged in with--insecure.requireConfigand the terminal UI printforge: plain http sends your token in clear; use https, or --insecure for a host you trustand exit 2. So someone already logged in to a remote http workbench sees this line on their next command, not a silent failure.[--insecure], and the README's CLI section explains the rule.test/cli-plain-http.test.tsrunsmain()itself withfetchstubbed and every request counted. It proves:--insecurepasses, is saved, andwhoamiworks afterwards;FORGE_URLis refused before any request, and a stored--insecuredoes not cover a differentFORGE_URL;sync.Not done: there is no environment variable that does what
--insecuredoes. Scripts that need a remote http workbench runforge login --insecureonce.To try it:
bun src/cli/main.ts login http://example.com --token xexits 2 with the refusal.bun src/cli/main.ts login localhost:3000still uses http.🤖 Generated with Claude Code
Closes #7377