refactor(migrator): centralize git in GitRunner
CI / test (push) Canceled after 0s

Introduce git.GitRunner as the sole git-op seam: the only place git is
invoked. It owns subprocess execution, per-op timeout, error redaction, and
auth delivery. Forge tokens move off the remote URL entirely onto a
non-persisted per-op http.<host>.extraHeader, so they never reach the
command line, a remote URL, or .git/config.

Rewrite the mirror procedure to drive GitRunner and retire the URL-token
helpers (_authed/_bare/_redact/_scrub_remote_tokens) plus the try/finally
scrub -- their reason to exist vanishes. mirror_repo's signature and report
stay unchanged; cli/migrate import the re-exported GitError/timeout
unchanged. The procedure's ordering invariants are now locked by a
recording-fake test, and an AST guard fails the suite if any git op bypasses
the seam.

Closes the 2026-08-11 audit's HIGH (token in GitError) and MEDIUM (token
in .git/config) at one structural root cause.

Closes #1
This commit is contained in:
AlexKucera committed 2026-08-11 15:36:35 +02:00
1 parent 137734673d
commit 1613ec72b8
10 files changed
+669 -223

No files matched your search

+11 -1
View File
@@ -106,7 +106,7 @@ When the user requests a durable behavior change, record it here or in the relev
<!-- gitnexus:start -->
# GitNexus — Code Intelligence
This project is indexed by GitNexus as **codeberg-to-gitea-migrator** (239 symbols, 448 relationships, 11 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
This project is indexed by GitNexus as **codeberg-to-gitea-migrator** (392 symbols, 767 relationships, 30 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
> Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939).
@@ -146,3 +146,13 @@ This project is indexed by GitNexus as **codeberg-to-gitea-migrator** (239 symbo
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
<!-- gitnexus:end -->
## Session Logs
Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Full history: [`docs/devlog/INDEX.md`](docs/devlog/INDEX.md). The 10 most recent:
<!-- write-log: window-start -->
| Date | Type | File | Summary |
|------|------|------|---------|
| 2026-08-11 | issue | [20260811-issue1-gitrunner-sole-git-op-seam_log.md](docs/devlog/20260811-issue1-gitrunner-sole-git-op-seam_log.md) | Introduce `git.GitRunner` as the sole git-op seam; rewrite mirror to drive it; retire URL-token helpers; closes audit HIGH A09 + MEDIUM A02 at the root. |
<!-- write-log: window-end -->