caelum0x cff329a525 fix(rithub): RIT-ACT stop leaking migrate auth token via git subprocess argv
Review of 369ab87a found realGitOps.run passing the Authorization header
to git as a `-c http.extraHeader=...` CLI flag, which lands in the git
child process's argv — readable by any other local process on
railyard-box via `ps -ef` or /proc/<pid>/cmdline for the full duration of
the clone/push (minutes, not milliseconds, for a real repo). This
directly contradicted the code's own doc comment claiming the token
never reaches argv. Verified live with a real `git clone` + `ps`: the
base64 Basic-auth token was plainly visible in process listing before
this fix, and gone after switching to GIT_CONFIG_COUNT/KEY/VALUE
environment variables (git >= 2.31), which only the owning uid/root can
read via /proc/<pid>/environ.

Also tightens the async-import job store file from 0644 to 0600 (and its
parent dir from 0755 to 0700): a Job's CloneAddr is stored unredacted,
so if a caller embeds credentials directly in the clone URL instead of
using auth_token, the persisted jobs.json file carried them world-
readable.

go build/vet/gofmt clean; go test ./... -race -count=1 passes all 3
packages. Still not deployed — same as 369ab87a, this is code-only, no
Caddy/pm2/systemd changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:15:07 +03:00
..