🐛 fix: P-18 the owner's SSH route covered

Merged
AT
1mo ago
+353-33

Slice: #46

Covers the owner's SSH route to GitHub (finding (c)). After machine signed gh out of the owner, git still reached GitHub as the owner over SSH, using the owner's ~/.ssh/id_ed25519 from the SSH agent. Stacked on #61 (P-17), whose env lock this relies on. It retargets to main once #61 merges.

  • The pre-push identity guard, for every adopter (spec G-6). onboard now writes the pre-push hook with identity alone, not only with work-rules, and replaces the hook older releases wrote. process-rules pre-push now takes git's remote URL and first checks who the push reaches GitHub as. In an agent session, it refuses:

    • a push to GitHub over SSH, because it would use this Mac's keys, which are the owner's;
    • over HTTPS, a push with credentials that are not the agent's. It asks git credential fill (never prompting) for the credentials git would push with, then asks GitHub's /user whose they are. A refusal names the account.

    An agent session is one where PROCESS_RULES_AGENT is set, or any shell where Claude Code sets CLAUDECODE=1, so the guard holds in a session whose Claude Code hooks never ran. The owner's own pushes are left alone. The hook runs the launcher from #61 and refuses an agent session's push when no CLI can run. The work rules follow as before when work-rules is on.

  • machine and doctor name the route. They run ssh -T -o BatchMode=yes git@github.com and name the account GitHub greets, other than the agent, with what covers it. Removing the route is out of scope, as docs/decisions.md records: the key is the owner's own way to GitHub, and an agent session runs as the same macOS user. The coverage is #61's env lock (SSH remotes on HTTPS, SSH refused) plus this guard. Only a separate macOS user would close a session that works around both on purpose.

Proof against the sandbox (athya-hq/process-rules-sandbox, cloned locally, this build's pre-push hook, the launcher pointing at this build; --dry-run, so nothing could be pushed):

  1. A Claude Code shell with the identity removed, pushing to git@github.com:athya-hq/process-rules-sandbox.git: SSH authenticated as the owner, then the guard refused with ✗ this push goes to GitHub over SSH, with this Mac's SSH keys, which reach GitHub as their owner, not AthyaBot….
  2. The agent session over HTTPS: the identity check passed, and the work rules then refused the slice-less probe commit.
  3. The owner's terminal (no CLAUDECODE) over SSH: the push went ahead.

git ls-remote shows no probe branch on the sandbox. On this Mac, this build's doctor printed ! ssh reaches GitHub as AlokBansal8 with this Mac's keys; ….

pnpm check passes (500 tests).

🤖 Generated with Claude Code