Code Hawk

Scan. Review. Test the fix.

Code Hawk scans and reviews pull requests, audits your repository, verifies fixes with tests, and records browser flows, all inside the GitHub Actions workflows you already run.

Open source. Runs in your own GitHub Actions with your own model key. The static scan needs no key.

Open Add a checkout order endpoint #128

Code Hawk PR scan

  • Semgrep CE No findings on added lines
  • Gitleaks No secrets in the commit range
  • OSV-Scanner No new advisories

Code Hawk PR review

  • Reviewed 6 files, 1 lockfile skipped
  • Posted 1 finding, $0.08 spent

codehawk commented on src/checkout/order.ts

41  const items = await loadCart(session.cartId);
42+ const total = req.body.total;
43+ await orders.insert({ items, total });

The order total comes from the client. req.body.total is written to the order unchanged, so a buyer can set their own price. Recalculate it from items on the server.

Suggested change

- const total = req.body.total;
+ const total = sumLineItems(items);

Open Deploy previews from pull requests #131

Code Hawk PR scan

  • Semgrep CE No findings on added lines
  • Gitleaks No secrets in the commit range
  • zizmor 1 workflow finding
  • OSV-Scanner No new advisories

Model use

  • None The scan makes no model calls

codehawk commented on .github/workflows/preview.yml

18      - name: Announce the preview
19+       run: echo "Deploying ${{ github.event.pull_request.title }}"

zizmor · template-injection

Template injection. The pull request title is expanded straight into a shell command, so a crafted title can run code on the runner. Pass it through an environment variable instead.

Static analysis. Found without a model, filtered to added lines.

Issue Session token written to the sign-in error log #214

Code Hawk weekly review · area auth

  • Security pass 2 potential findings
  • Bug pass 1 potential finding
  • Separate check 1 confirmed, 2 not confirmed
  • Filed 1 issue, $0.94 spent

codehawk opened this issue

Session token written to the sign-in error log

security src/auth/sign-in.ts:57

On a failed sign-in, logFailure(req) records the full request, including the session cookie. Anyone with log access can reuse a live session.

Confirmed by a separate check that read the cited file and its direct imports.

Two unconfirmed findings stay in the weekly summary and are not filed.

Draft Code Hawk fixes for 2026-11-21 #219

Code Hawk fix issues · #214

  • Test applied test/auth/sign-in.test.ts
  • Before the fix The new test fails
  • Fix applied src/auth/sign-in.ts
  • After the fix The new test passes
  • Published One draft PR, $0.21 spent

codehawk opened a draft pull request

Fixes #214 Redact the session cookie before logging a failed sign-in.

$ npm test -- sign-in   # before the fix
✗ redacts the session cookie in failure logs
$ npm test -- sign-in   # after the fix
✓ redacts the session cookie in failure logs

The pull request stays a draft. A person marks it ready and merges it; Code Hawk never does.

Illustrative examples. Each job posts in its own place: line comments on added lines, issues for confirmed findings, and draft pull requests for fixes.

The jobs

Five jobs. Turn on the ones you need.

Each job has its own caller workflow and trigger. Every model job has its own spend cap.

Runs on pull_request

PR scan

Static checks on every pull request.

Semgrep CE, Gitleaks, zizmor, and OSV-Scanner run against the PR. Read the results in the PR or the runner log.

Model
None
Posts
Findings on added lines and new dependency advisories
Default cap
No model spend
Read the PR scan guide
Runs on pull_request

PR review

A careful read of every added line.

Review added lines in context for concrete bugs and security faults. One summary is kept current as the PR changes.

Model
Review model
Posts
Line comments, suggested fixes, one summary
Default cap
$1 per run
Read the PR review guide
Runs on schedule

Weekly review

One area of the repository each week.

Rotate through repository areas. A second model checks each potential finding before Code Hawk files an issue.

Model
Find passes, then a separate check
Posts
Issues for confirmed findings
Default cap
$3 per run
Read the Weekly review guide
Runs on issue label or maintainer request

Verified fixes

Fixes that prove themselves first.

Turn labelled issues or current review findings into draft changes. Each fix comes with a test that fails before the change and passes after it.

Model
Up to two calls per item
Posts
Draft changes with failing-first evidence
Default cap
$1 per item, $3 per run
Read the Verified fixes guide
Runs on PR label

Browser flows

Plain-language tests, recorded.

Follow plain-language flows against a seeded copy of your app with Playwright, and record each run.

Model
Planner and driver
Posts
A report with private video and screenshot links
Default cap
$1 per run
Read the Browser flows guide

New here? Begin with the scan. It needs only the GitHub App.

Security

Review code. Limit access.

Pull requests, model output, and write credentials each sit behind a different trust boundary.

Read the trust model
  1. Trusted PR events

    The scanner and review callers use pull_request. Code Hawk does not use pull_request_target. Model review reads the trusted base config and does not execute PR code.

  2. Separate fix and publish

    Model-written fixes are tested using a read-only workflow token. A separate job validates the patch and publishes with the App token.

  3. Narrow permissions, pinned actions

    Jobs request only the permissions they need. Actions are pinned to full commit SHAs.

  4. Fork handling

    Static scans can log findings without posting. Model-assisted PR reviews and replies skip fork pull requests.

  5. Defanged output, bounded spend

    Generated text is validated and mentions are neutralized before posting. Model jobs have per-run spend caps by default.

Quick start

From install to your first review.

  1. Install the GitHub App

    Choose the repositories where Code Hawk should run. GitHub then brings you back to the setup checklist.

    Install on GitHub
  2. Choose a model

    Sign in on the setup page and pick a provider and model. They are added to the setup pull request the App opened.

  3. Add one model key

    Save it as an Actions secret. The checklist names the secret and links to the right settings page.

  4. Merge and open a pull request

    Merge the setup pull request, then open any pull request to get your first scan and review.

Already installed the App? Open the setup checklist

See manual caller workflows
.github/workflows/pr-scan.yml
name: PR scan

on:
  pull_request:
    branches: [main]
    types: [opened, synchronize, reopened, ready_for_review]

concurrency:
  group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }}
  cancel-in-progress: true

permissions: {}

jobs:
  scan:
    if: ${{ !github.event.pull_request.draft }}
    permissions:
      contents: read
      id-token: write
    uses: bts-io/codehawk/.github/workflows/pr-scan.yml@<sha> # codehawk <version>
.github/workflows/pr-review.yml
name: PR review

on:
  pull_request:
    branches: [main]
    types: [opened, synchronize, reopened, ready_for_review]

permissions:
  contents: read

concurrency:
  group: pr-review-${{ github.event.pull_request.number }}
  cancel-in-progress: true

jobs:
  review:
    if: >-
      vars.PR_REVIEW_ENABLED == 'true' && !github.event.pull_request.draft &&
      github.event.pull_request.user.type != 'Bot' &&
      !endsWith(github.event.pull_request.user.login, '[bot]')
    permissions:
      contents: read
      pull-requests: read
      id-token: write
    uses: bts-io/codehawk/.github/workflows/pr-review.yml@<sha> # codehawk <version>
    secrets:
      CODEHAWK_OPENAI_API_KEY: ${{ secrets.CODEHAWK_OPENAI_API_KEY }}

Try Code Hawk on your next pull request.

Install the App and GitHub brings you back to a setup checklist: pick a model, add your key, merge the setup pull request.

Open source. Runs in your own GitHub Actions with your own model key. The static scan needs no key.