Docs / GitHub Integration

GitHub Integration

Install the Ferro GitHub App to clone private and public repositories with short-lived single-repo tokens, report rich GitHub Checks, coalesce push + PR events, and gate fork pull requests.

1. Connect the GitHub App (recommended)

Open Dashboard → Projects (or the Overview onboarding checklist) and click Connect GitHub. Ferro redirects to GitHub with a signed, org- and user-bound state parameter and verifies installation ownership before storing the connection.

  • One-click repository linking: Choose any installed repository to prefill repoFullName, defaultBranch, and visibility (private vs public) without copying webhook URLs or secrets.
  • Short-lived clone credentials: When a runner node claims a run, the control plane mints a single-repository installation token scoped strictly to contents:read. The agent passes it to git via an isolated GIT_ASKPASS script and redacts it from all logs—never writing credentials into argv, remote URLs, or mirror configs.
  • GitHub Checks API: Ferro creates a Check Run when a run is queued, transitions it to in_progress on claim, and completes it with conclusion, duration, exit code, and a direct link to the run logs.
  • Push + PR coalescing & delivery dedup: POST /api/webhooks/github-app verifies X-Hub-Signature-256 fail-closed, deduplicates X-GitHub-Delivery IDs, rate-limits per installation (not shared GitHub egress IPs), and coalesces duplicate push + pull_request events for the same head SHA into a single run.

Self-hosting operators can register the App from docs/github-app-manifest.json and configure GITHUB_APP_ID, GITHUB_APP_SLUG, GITHUB_APP_PRIVATE_KEY, GITHUB_APP_WEBHOOK_SECRET, and GITHUB_APP_CLIENT_ID/GITHUB_APP_CLIENT_SECRET.

2. Legacy manual per-project webhooks (deprecated)

Deprecated for new projects

Manual per-project webhooks + static Personal Access Tokens remain supported for existing projects, but cannot mint short-lived private repo clone tokens or post GitHub Checks. Use the Migrate to GitHub App action on any legacy project card in Dashboard → Projects.

Legacy projects expose a per-project endpoint at POST /api/webhooks/github/[projectId] verified fail-closed against X-Hub-Signature-256 with an AES-256-GCM encrypted webhook secret and optional PAT for commit status reporting under Ferro BYO-Metal CI.

Legacy GitHub Webhook Settings
Payload URL:   https://<YOUR_FERRO_HOST>/api/webhooks/github/<PROJECT_ID>Content type:  application/jsonSecret:        <ONE_TIME_WEBHOOK_SECRET>Events:        Pushes (push) and Pull requests (pull_request)

Note: The global GITHUB_TOKEN environment variable is a dev/test-only fallback and is ignored in production.

3. Fork PR trust model & approval gate

Ferro detects external fork pull requests on every pull_request webhook by comparing pull_request.head.repo.full_name against pull_request.base.repo.full_name (missing repo metadata is also treated as an untrusted fork). Each project enforces one of three forkPrPolicy settings:

PolicyBehaviorProject Secrets
require_approval DefaultEnqueues the run with approvalState = "pending" and posts a pending GitHub status (Awaiting maintainer approval in Ferro). Agents cannot claim the run until an org owner or admin approves or rejects it in the Run Inspector.Withheld by default on approval; an owner/admin may explicitly choose “Approve with secrets” if trusted.
run_without_secretsEnqueues with trusted = false and approvalState = "not_required", allowing an eligible runner to claim immediately.Never sent (envSecrets = {}).
disabledIgnores fork PR webhooks completely (reason: "fork_pr_disabled").Not executed.

Runner host isolation caveat for public repos

Even when project secrets are withheld (run_without_secrets or standard approval), ferro-agent isolates jobs via an OS-level sandbox (ferro-job UID, read-only rootfs, masked agent stores, copy-on-restore isolated PR caches, and cgroup v2 limits) rather than a Firecracker/KVM microVM. Sandboxed jobs still share the host Linux kernel and host network namespace and have no hard per-run disk quota unless /var/lib/ferro-agent sits on a quota-enforced filesystem. For public repositories, keep require_approval or disabled and review PR diffs before approving. See Security Model.