Skip to content

Trust model

Code Hawk runs in the caller's GitHub Actions environment. Use pull_request for scans and model reviews. Never move these callers to pull_request_target. A caller's events, repository access, and runner environment are part of the boundary.

  • Static scan: The scanner sees proposed files in a read-only mount and does not get the posting token. A later step can post with an App token. No post is made for a fork or Dependabot.
  • Model review: The workflow checks out only trusted base configuration. It reads proposed lines and immutable blobs through the GitHub API as data. It does not run the proposed tree. Forks and missing credentials take the skip path.
  • Replies: A default-branch comment workflow can have secrets even for a fork PR. The workflow checks the head repository before minting an App token, and the action checks again and verifies the commenter's repository permission before calling a model.

For hosted related context, B's maintainers grant read access to A's workflows through related_context.allow on B's default branch. A cannot grant this access to itself. Anyone who can run workflows in A can then read B, including writing that context into review comments on A. The Worker refuses private B for public A regardless of consent, using installation-scoped API visibility for both repositories.

Provider and model routes, fallbacks, prices and caps come from .github/codehawk.json, read only from the default branch through the GitHub API. Its base_url chooses a compatible endpoint or Cloudflare gateway, and credential selects one of eight forwarded credential slots. Without a slot, the provider selects its standard named secret. Maintainers of that file can therefore choose where a forwarded key is sent. Approve endpoints and DNS before merging settings changes.

The file cannot contain key values, choose arbitrary secret names, add custom headers or register connectors. Direct provider origins are fixed. Compatible endpoints must pass the HTTPS endpoint policy, which does not filter resolved DNS addresses. Connectors reject redirects. PR text, model output and provider responses cannot change routes. The optional legacy inference document comes from the caller and overrides file routes for one release. See inference.

The default-branch file does not protect caller workflow inputs. A collaborator who can push a branch can also edit that branch's caller workflow on pull_request events, including the inference document, cap inputs and workflow or action pins. A nonempty legacy inference input overrides file routes, and a cap input can raise or remove a file cap. Protect workflow files with CODEOWNERS and rulesets. The hosted Worker still requires an allowed released reusable workflow and enforces its event permission slice.

  • Weekly review reads the selected branch and issues, treats source as evidence, and only turns confirmed findings into issues. The job has no repository write permission outside issues.
  • Verified fixes run model-authored code in the test stage with a read-only workflow token, inside secret-free containers with private PID namespaces from a trusted digest-pinned test image. The publish stage has write credentials, no checkout, and revalidates the patch against trusted config before committing through the API.
  • Browser flows execute the proposed application and any enabled fixture setup code, each in a secret-free container started from the caller's trusted digest-pinned image. The coordinator keeps inference, posting, and upload credentials outside those containers. Keep the browser caller restricted to trusted runs and a throwaway environment.

Each job uses scoped permissions. Full SHA pins make the loaded workflow and action revisions explicit. Model output is validated before posting, and spend caps apply only when set. Every model job is uncapped by default. The installation setup pull request writes starter caps.

The setup page uses GitHub sign-in to identify repositories the user can write to. The Worker rechecks write access and App installation before reading or saving settings. Its user token is encrypted in server-side session storage and used only for identity and repository access checks, then revoked on logout or expiry. A separate installation token writes only the settings file through a pull request and is revoked after use. It has no workflows permission. The page never receives model keys, never stores settings in the browser and cannot apply a change without a pull request being merged. Per-job routes that name their own provider stay in the file. Named API entrypoints are reachable only through Service Bindings, not through a public URL. Origin, fetch metadata and CSRF checks protect state-changing routes.

Comment commands never apply settings directly. They open a pull request for .github/codehawk.json, or add a commit to the open setup pull request, and a person reviews and merges it. GitHub's permission API must confirm write, maintain or admin access. The settings job has no checkout or model keys and cannot request workflows permission. It reads the live comment again, refuses fork pull requests and stops if the settings moved after its read.