Some checks failed
ci / cargo test (abacus) (push) Has been cancelled
ci / cargo test (agent-runtime) (push) Has been cancelled
ci / cargo test (context-passport) (push) Has been cancelled
ci / cargo test (game-economy) (push) Has been cancelled
ci / cargo test (ledgerline) (push) Has been cancelled
ci / cargo test (mint) (push) Has been cancelled
ci / cargo test (rago) (push) Has been cancelled
ci / cargo test (relay) (push) Has been cancelled
ci / cargo test (toolgate) (push) Has been cancelled
ci / cargo test (turnstile) (push) Has been cancelled
ci / cargo test (vend) (push) Has been cancelled
ci / node suites (push) Has been cancelled
Gap 1 (server-side enforcement): a raw `git push --force`/branch-delete made with an agent-session token, bypassing `rit push`'s own client-side hold, landed directly before this change. New apps/rithub-agent-gateway sits in front of the one real git-smart-HTTP write route (POST .../git-receive-pack, Caddy handle block on railyard-box) as a pkt-line-aware reverse proxy: a token the server already knows is agent-session-attributed (marked via the new POST /approvals/api/agent-session/mark, called by every `rit` command when RITHUB_AGENT_SESSION_ID is set) doing a delete or a push to a protected branch is held into refs/pending/<id> and registered as a real approval, same ledger/code path rit push already uses -- the client gets a clean `ng ... held for approval` rejection. Every other push (human tokens, unmarked tokens, agent pushes to non-protected branches) is a pure byte-for-byte passthrough, zero behavior change. Gap 2 (no pasted tokens): /approvals now uses the signed-in rithub.dev session cookie plus a one-time real OAuth2 (PKCE, same "Rit CLI" engine app `rit login` uses) authorize step -- no owner/repo fields, no token field, anywhere on the page. GET /approvals/api/mine lists pending approvals across every repo the signed-in human can push/admin; approve/ deny are one click each (POST /approvals/api/mine/:id/approve|deny). Live-verified on rithub.dev with a fresh mail.tm test account: plain `git push --force` and `git push origin :branch` with an agent-session token both held (target ref/branch untouched); a human-token push landed directly, unaffected; the signed-in web page approved the exact staged commit and denied the delete leaving the branch untouched; full route regression + clone/fetch stayed 200; no token/hash/email leaked in any API response. Test account and repo deleted after. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
// pm2 process definition for Rithub's agent-push server-side enforcement
|
|
// gateway (RIT-ACT gap 1, 2026-12-01). Bound to 127.0.0.1 only -- public
|
|
// exposure is via Caddy's `handle` block matching ONLY
|
|
// `POST /{owner}/{repo}(.git)/git-receive-pack` on rithub.dev (see
|
|
// /etc/caddy/sites-enabled/rithub-dev.caddy) -- every other git/web/API
|
|
// path keeps going straight to the engine (127.0.0.1:3350), unchanged.
|
|
module.exports = {
|
|
apps: [
|
|
{
|
|
name: "rithub-agent-gateway",
|
|
cwd: __dirname,
|
|
script: "bin/start.mjs",
|
|
env: {
|
|
NODE_ENV: "production",
|
|
PORT: "3363",
|
|
RITHUB_UPSTREAM_HOST: "127.0.0.1",
|
|
RITHUB_UPSTREAM_PORT: "3350",
|
|
RITHUB_APPROVALS_URL: "http://127.0.0.1:3361",
|
|
RITHUB_BASE_URL: "https://rithub.dev",
|
|
// Same data dir as rithub-approvals -- this service only ever
|
|
// READS agent-session-tokens.json from it, never writes.
|
|
RITHUB_APPROVALS_DATA_DIR: "/var/lib/rithub-approvals/",
|
|
},
|
|
autorestart: true,
|
|
max_restarts: 10,
|
|
min_uptime: "10s",
|
|
},
|
|
],
|
|
};
|