#157: convert forge worktree origins to SSH #177
Reference in New Issue
Block a user
Delete Branch "worker/fleetd-157-remote-url-5d7e49-5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #157. Provisioning changes the LTMS forge origin from HTTPS to SSH before it creates a linked worktree, so a credential cannot remain in the shared git config. Tests: mvn clean install (BUILD SUCCESS; 971 tests).
Not merging this shape. Recording why, because "why not just use SSH remotes?" will be asked again.
#157 lists SSH remotes as option 1 and I briefed it as the default. That was wrong, for a reason that is only visible from outside this PR:
A parallel change turns on
memberCredentials.policy: allow-list. Under it,SSH_AUTH_SOCKis deliberately blocked for members even though the name is in theallow:list. It is a live agent handle, not a value — allowing it hands a member every key the operator's agent holds (see #110).On this host
~/.sshholds no private key file at all — onlyauthorized_keys,configandknown_hosts. Thegit.ltms.devidentity exists solely inside the ssh-agent.So an
ssh://origin can authenticate only through the agent, and the agent is about to be unreachable from members. This change would convert a working HTTPS origin into an SSH origin that a member cannot push with — a leaky-but-working setup traded for a secure-but-broken one, silently, for exactly the repos #157 is about.The push in this PR succeeded because the
fleetdrepo's origin was already SSH and the agent is still reachable today. That proves SSH works now. It does not prove it works after the allow-list lands.Going with option 2 instead: a git credential helper that supplies
WORKER_GITEA_TOKENat call time. That name stays allowed underallow-list, so it composes with the credential scrub rather than fighting it, and the origin stays HTTPS and clean — which is all #157 actually requires.Two further changes requested on the same branch:
FORGE_HOST/FORGE_SSH_PORTare hardcoded. Config already carriesgitHostEnv: GITEA_HOST. A security control that silently does nothing for any other forge host has a hole in it.remote.origin.urland refuses to provision if user info is still present. Setting a value and never confirming it took is the same shape as #175.Kept from this revision: provisioning-time placement, and
aProvisionedWorktreeUsesTheForgeSshOriginreading the worktree's realremote.origin.urlrather than a formatter — that is the right test shape, and it should survive the rewrite with a new assertion.Correction to my own review reasoning on this PR (2026-08-28) — see #184.
While reviewing this I wrote that
~/.sshholds no private key file and the forge identity lives only in the ssh-agent, and I used that to argue the change was urgent: blockSSH_AUTH_SOCKand a member could not push at all.That fact was wrong. I had looked only in
~/.ssh, which is fourIncludelines.ssh -G git.ltms.devresolves a readable, passphrase-freeIdentityFileelsewhere, and a live member with the socket blanked pushed over SSH fine.The merged change is still correct — it takes the token out of git config, which was the real defect in #157, and it routes a member through its own scoped credential so its pushes are attributable and revocable. Only my urgency argument rested on the false fact. The javadoc on
configureHttpsUrlRewriteForSshOriginrepeated the same claim and has been corrected onmain.