Repository navigation
Description
Part of #1834.
Scope
A caller who passes --allow-insecure-http, sets SIMLOCK_ALLOW_INSECURE_HTTP=1, or gives a Node client allowInsecureHttp: true reaches a farm at http://<any host> from every CLI command, simlock tunnel, simlock files, simlock mcp, connectSimlock and connectSimlockAdmin. Without it, the refusal names the opt-in.
If it goes wrong: a command checks the URL a second time without the opt-in and fails after it connected, or a leftover variable breaks a local command.
Technical spec
Commit 200afe5.
Rows
Behaviours: B1, B2, B3, B4, B5
Interfaces: I1, I2, I3, I4, I5
Existing code: X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14
Facts
| # | Fact | Source |
|---|---|---|
| F1 | The tunnel tests assert today's scheme words for two inputs: http://10.0.0.5:7300 (refused for its host, so it gains I1's hint) and a 2049-character https:// URL (refused by the length step, which shares the scheme words and keeps them with no hint) |
src/cli/tunnel.test.ts:117 (host), :155-157 (length) |
| F2 | checkedFarmUrl on main accepts https:// and loopback http:// and refuses http://100.75.181.35:4700, http://127.0.0.2:4700, ws://, ftp:// and a URL with no scheme with the scheme message |
node --experimental-strip-types on a script calling src/simlock-client/farm-url.ts at 200afe5; output in the feature's Examples |
Modules touched
src/simlock-client (farm-url.ts, remote-connector.ts), src/client, src/admin, src/cli (index.ts, environment.ts, types.ts, tree.ts, connect.ts, commands/tunnel.ts, commands/lease.ts, commands/mcp.ts), src/mcp (main.ts, connect.ts), website reference/cli.mdx, reference/node-client.mdx, using-devices/node-client.mdx. Searches: checkedFarmUrl, remoteConnectOptions, checkedFarm(, RemoteFarm, connectToFarm, only for 127.0.0.1.
flowchart LR
cli[src/cli router] --> conn[src/cli/connect.ts]
cli --> tun[commands/tunnel.ts]
conn --> admin[src/admin]
conn --> mcp[src/mcp]
mcp --> client[src/client]
admin --> rc[simlock-client/remote-connector.ts]
client --> rc
rc --> fu[simlock-client/farm-url.ts]
conn --> fu
tun --> fu
Rules in play
- documentation.md rule 9: the new flag, variable and option are public surface; B5 updates the pages in this PR.
- architecture.md rule 8: the CLI only parses the flag and variable and passes them on; the rule itself stays in
checkedFarmUrl. - ADR 0081 §3: every frontend keeps the one URL rule, now with the opt-in.
src/simlock-client/AGENTS.mdandsrc/client/AGENTS.md: the URL rule line stays true; add the opt-in to it.
Tests
Seam: runCli with a faked environment, modelled on src/cli/index-remote-mode.test.ts and src/cli/tunnel.test.ts; connectSimlock/connectSimlockAdmin with a fake webSocket, modelled on src/simlock-client/remote.test.ts.
- B1: an http farm URL to a non-loopback host with no opt-in exits 2 with I1's hinted refusal:
whoami --url;SIMLOCK_URL;tunnel forward 8081;files list;mcp; an empty variable;https://and loopbackhttp://not refused - B2: with the flag before or after the command, or the variable
1, the command reaches the farm atws:///http://:whoami;leasethrough its reconnect notice;tunnel forward 8081;files list;mcptool-call connect - B3: the opt-in changes nothing else:
ws://,ftp://, no scheme; a path; 2049 characters;--allow-insecure-http=1; flag with--localand no URL; variabletruewith an http URL, and with no URL; leftoverSIMLOCK_URLwith--local:tunnelvswhoami, variable1andtrue - B4: Node clients: no option,
false,true(client and admin);"yes";truewithendpointand nourl;truewithws:// - B5: the website rows and the
--helptext name the opt-in
Done when
pnpm test:changedandpnpm typecheckpass; the B1–B4 tests pass withpnpm exec vitest run --project unit <file>.- The website builds:
pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs. - The pages in B5 name the opt-in.
Out of scope
Everything under the feature's Non-goals.
Depends on
Written by an agent.
Activity
test: an http farm URL with no opt-in is refused naming the flag and …
feat(cli): the refusal of plain http names the opt-in (#1839)
test: lease, tunnel, files and mcp reach an http farm with the opt-in (…
test: the opt-in changes nothing else and a bad variable is refused o…
feat(cli): a bad SIMLOCK_ALLOW_INSECURE_HTTP is refused at a farm URL…
test: a Node client reaches an http farm only with allowInsecureHttp:…
feat(client): allowInsecureHttp must be a boolean (#1839)
test: the --help text names the plain-http opt-in (#1839)
refactor(cli): split the farm env fields and the value-flag scan out …
test: a long http URL with no opt-in is refused without the hint; the…
fix: restore the simlock-client manual line; tunnel --local with a le…
feat(cli): plain http to a remote farm by explicit opt-in (callstacki…