Strix GitHub Actions setups usually stop at one line: strix -n -t ./ --scan-mode quick. That scans the code in a pull request, but it never touches the running app, and that's where Strix proves a finding by exploiting it. This guide shows how to run Strix in GitHub Actions against a staging or PR preview environment you control: a white-box scan of the changed code plus the live app, an OpenAPI spec that keeps the scope tight, SARIF results in GitHub code scanning, and a budget cap so a pull request can't run up your bill.
If you haven't set up Strix with a custom model yet, start with Use Strix With an OpenAI-Compatible API. It covers the environment variables, --max-budget pricing and common endpoint errors. This post assumes that setup works and focuses on Strix CI/CD. Short version in the docs.
Scan only what you own. A staging or preview app is yours to test, but the services it calls may not be. Payment sandboxes, identity providers and third-party APIs are other companies' systems. Put them out of scope in writing, as shown below. RedRouter's terms prohibit testing systems you aren't authorized to test.
What we verified and what we didn't
Every flag, environment variable and behavior below comes from the Strix repository at release v1.7.1 (published November 10, 2026) and its docs, read on November 14, 2026. We ran two things: the yq command that rewrites an OpenAPI spec's servers list, and Strix's own spec_base_urls function from the v1.7.1 source, to confirm which hosts it treats as in scope. Those checks did not run a full scan.
2026-11-15 update: Two GitHub-hosted ubuntu-latest runs used the RedRouter Security Action, Strix 1.7.1 and red-cyber-1, each taking about 13 minutes: code-only ($0.83 of $0.90) and repository plus a sample web app ($0.97 of $1.00); both ended at their budget caps with no findings at or above high.
For the second run, a coding agent given only the setup prompt wrote the scope file and redrouter/security-action@v0 workflow, with one manual edit lowering the budget cap to $1; it started the app on the runner and finished green, with a spend line and the comment: "No findings at or above high. The budget cap was reached, so the scan is incomplete."
An earlier version of the plain-Strix workflow in the docs ran with Strix 1.7.1 on a GitHub-hosted runner before continue-on-error was added to the upload step, with the endpoint pointed at a scripted mock and only the endpoint, key and app/mock start steps changed; the workflows below use different setup-uv and uv pins and were not run, nor were other models or plain-Strix web-app scans with a RedRouter model.
Why scan the running app, not just the code
The CLI reference lets you pass --target more than once, and the help text calls source plus a deployed URL "white-box testing with source and deployed app." The scan modes page explains the payoff: standard and deep scans use "source-aware mapping and static triage to prioritize dynamic exploit validation paths." The code tells Strix where to look, and the running app lets it confirm the bug.
In CI there are two places to find a running app:
- Inside the job. Start the app with Docker Compose on the runner and target
http://localhost:<port>. This is the cleanest scope, because nothing leaves the runner except model calls. - A staging environment you already run. Better for longer, scheduled scans against something closer to production.
The rest of this post builds both.
Pattern 1: run Strix in GitHub Actions against the app on the runner
Strix runs its tools inside a Docker sandbox, so localhost inside the sandbox isn't your runner. Strix handles this for you. In v1.7.1, build_targets_info rewrites any localhost web or IP target to host.docker.internal, and the sandbox container gets host.docker.internal mapped to the Docker host gateway. One catch follows from that: the gateway reaches ports published on the host's network interfaces, so publish your app's port normally ("8080:8080"), not on 127.0.0.1 only.
The workflow:
# .github/workflows/strix-pr.yml
name: Strix PR scan
on:
pull_request:
permissions:
contents: read
security-events: write
actions: read
jobs:
strix:
# Fork PRs get no secrets, so skip them instead of failing.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # needed for diff-scope
- name: Start the app
run: docker compose up -d --wait
- name: Set up uv (pinned)
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: "0.13.8"
python-version: "3.12.14"
- name: Run Strix
id: strix
env:
STRIX_LLM: openai/glm-5.3-flash-red
LLM_API_KEY: ${{ secrets.REDROUTER_CI_KEY }}
LLM_API_BASE: https://redrouter.org/v1
STRIX_API_TYPE: chat_completions
STRIX_IMAGE: ghcr.io/usestrix/strix-sandbox@sha256:c8e70302ba4a69b678b4001c909b134d8d0b84625d7b23feed59ece02672c1d2
STRIX_LLM_INPUT_COST_PER_MTOK: "0.25"
STRIX_LLM_CACHED_INPUT_COST_PER_MTOK: "0.10"
STRIX_LLM_OUTPUT_COST_PER_MTOK: "1.00"
STRIX_TELEMETRY: "0"
run: |
set +e
uvx --from git+https://github.com/usestrix/strix.git@685bbc8138d35fc9fe378ac37ec0d9198b9c46a3 strix -n -t ./ -t http://localhost:8080 \
--scan-mode quick --fail-on high \
--max-budget 3 --max-turns 150 \
--instruction-file .github/strix-scope.md
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
- name: Find SARIF
id: sarif
if: always()
run: echo "path=$(find strix_runs -name findings.sarif -print -quit 2>/dev/null)" >> "$GITHUB_OUTPUT"
- name: Upload to code scanning
continue-on-error: true
if: always() && steps.sarif.outputs.path != ''
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.sarif.outputs.path }}
category: strix-pr
- name: Keep the full report
if: always()
uses: actions/upload-artifact@v7
with:
name: strix-run
path: strix_runs/
- name: Fail on findings or errors
if: steps.strix.outputs.exit_code != '0'
run: exit ${{ steps.strix.outputs.exit_code }}
Line by line, here is what each piece does and where it comes from.
Pinned install. The pinned uv step adds uvx to PATH. It runs Strix 1.7.1 from a commit SHA; STRIX_IMAGE pins the sandbox by digest. Pinning keeps a new release from changing your required check overnight.
Headless mode and exit codes. -n runs without the TUI. The GitHub Actions guide and CLI reference define the exit codes: 0 for no findings at or above the --fail-on threshold, 1 for an execution error (missing variables, Docker unavailable, a diff-scope failure), and 2 for findings. The workflow captures the code with set +e instead of failing straight away, so the SARIF upload and artifact steps still run, and then fails the job at the end.
--fail-on high. Only high and critical findings fail the check. Lower findings still go into every report file, so a green check isn't the same as an empty report. A finding with a severity Strix can't rank always counts.
Diff-scope. With --scope-mode auto (the default), Strix limits code targets to changed files when it detects a CI pull request. In v1.7.1 it checks for GITHUB_ACTIONS or CI and for GITHUB_BASE_REF or GITHUB_HEAD_REF. It needs full git history to find the merge base, hence fetch-depth: 0. Use --scope-mode full to scan the whole repository, or --diff-base origin/main to set the base yourself. Diff-scope applies to code targets, not to the URL.
Budget and turns. --max-budget 3 stops a headless scan cleanly once estimated model spend reaches $3, and sub-agents stop at 90% so the root agent can write the report. That estimate only works for a custom model if you set the STRIX_LLM_*_COST_PER_MTOK prices, which the first Strix post explains. --max-turns caps each agent's turns (default 500).
Fork pull requests. GitHub doesn't pass repository secrets to workflows triggered from forks (GitHub docs). Without the if: line, every fork PR would fail at Strix's model preflight. Don't work around this with pull_request_target and a checkout of the fork's code, which hands your secrets to code you haven't reviewed.
The writable checkout. A local directory target is mounted into the sandbox "live and writable," and the agent can edit real files except .git. On a throwaway runner that's fine, but don't build or deploy from the same workspace after the scan step.
Write the scope file
The scope builder writes the RedRouter Security Action workflow and .github/scope.yaml; this post gives the plain-Strix alternative.
--instruction-file puts free-text rules into the scan prompt. Keep it short and specific:
# .github/strix-scope.md
In scope:
- The source code in this repository.
- The running app at http://localhost:8080 and nothing else.
Strix rewrites http://localhost:8080 to http://host.docker.internal:8080 in the sandbox; both names mean this app under test and are in scope.
Out of scope:
- Any other host, including URLs found in source, config, or responses.
- Third-party services the app calls (payments, email, identity providers).
- Denial-of-service, load testing, or anything that deletes data.
Test accounts (seeded test data only):
- user: ci-user@example.test / see STRIX_TEST_PASSWORD
Two cautions from Strix's instructions docs. Instructions become part of the prompt, so anything in this file is sent to the model; use seeded test accounts, never real ones. And if you place extra files in the sandbox with --workspace-file, the docs warn not to include secrets, because "the sandbox runs untrusted target code, so treat anything you place there as readable by the target."
Pattern 2: a nightly scan of staging with an OpenAPI spec
For a deeper scan of a long-lived staging environment, run on a schedule instead of on every PR. If your API has an OpenAPI or Swagger file, give it to Strix as a target. The CLI reference says Strix then "reads the contract and tests the full declared surface instead of discovering endpoints by crawling." Postman collection exports and live collections (postman://<collection-uuid>, with POSTMAN_API_KEY) work too.
There's a scope detail here that's easy to miss. When the target is a spec, Strix "authorizes the base URLs it declares … as in-scope hosts." In the v1.7.1 source, spec_base_urls returns every absolute URL in an OpenAPI servers list, or host plus basePath for Swagger 2.0. Many specs list production first. Pass that file unchanged and production is in scope.
Rewrite the spec in the job so it declares only staging. yq is preinstalled on GitHub's Ubuntu runners:
STAGING_URL=https://staging.example.com \
yq '.servers = [{"url": strenv(STAGING_URL)}]' openapi.yaml > openapi.ci.yaml
We checked this against Strix's own parser. For a spec that listed https://api.example.com and https://staging.example.com, spec_base_urls returned both. After the rewrite (using a preview URL as the value) it returned only ['https://pr-42.preview.example.net'].
The scheduled workflow, with the same SARIF, artifact and exit-code steps as Pattern 1:
# .github/workflows/strix-nightly.yml
name: Strix nightly staging scan
on:
schedule:
- cron: "17 9 * * *"
workflow_dispatch:
permissions:
contents: read
security-events: write
actions: read
jobs:
strix:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v7
- name: Pin the spec to staging only
env:
STAGING_URL: ${{ vars.STAGING_URL }}
run: yq '.servers = [{"url": strenv(STAGING_URL)}]' openapi.yaml > openapi.ci.yaml
- name: Set up uv (pinned)
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
version: "0.13.8"
python-version: "3.12.14"
- name: Run Strix
id: strix
env:
STRIX_LLM: openai/red-cyber-1
LLM_API_KEY: ${{ secrets.REDROUTER_NIGHTLY_KEY }}
LLM_API_BASE: https://redrouter.org/v1
STRIX_API_TYPE: chat_completions
STRIX_IMAGE: ghcr.io/usestrix/strix-sandbox@sha256:c8e70302ba4a69b678b4001c909b134d8d0b84625d7b23feed59ece02672c1d2
STRIX_LLM_INPUT_COST_PER_MTOK: "0.28"
STRIX_LLM_CACHED_INPUT_COST_PER_MTOK: "0.10"
STRIX_LLM_OUTPUT_COST_PER_MTOK: "1.10"
STRIX_TELEMETRY: "0"
run: |
set +e
uvx --from git+https://github.com/usestrix/strix.git@685bbc8138d35fc9fe378ac37ec0d9198b9c46a3 strix -n -t ./ -t ./openapi.ci.yaml -t "${{ vars.STAGING_URL }}" \
--scan-mode standard --fail-on high \
--max-budget 15 --max-turns 300 \
--instruction-file .github/strix-scope-staging.md
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
- name: Find SARIF
id: sarif
if: always()
run: echo "path=$(find strix_runs -name findings.sarif -print -quit 2>/dev/null)" >> "$GITHUB_OUTPUT"
- name: Upload to code scanning
continue-on-error: true
if: always() && steps.sarif.outputs.path != ''
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.sarif.outputs.path }}
category: strix-nightly
- name: Keep the full report
if: always()
uses: actions/upload-artifact@v7
with:
name: strix-run
path: strix_runs/
- name: Fail on findings or errors
if: steps.strix.outputs.exit_code != '0'
run: exit ${{ steps.strix.outputs.exit_code }}
Notes on the choices:
- Standard, not deep. The scan modes page puts standard at 30 minutes to an hour and deep at 1 to 4 hours, recommending deep before major releases. The GitHub Actions guide's own tip says to "Schedule
deepscans nightly," so switch todeep(and raise--max-budgetandtimeout-minutes) if your staging app is small enough to finish in the window. Deep is also the default when you pass no--scan-mode, so always set the mode explicitly in CI. - Pass the spec and the URL. The CLI reference says to pair a spec with "the deployed base URL" so the agent has a reachable host.
- No diff-scope here. On a scheduled run there's no pull request, so in auto mode Strix doesn't turn on diff-scope for a run on the default branch, and the code target is scanned in full. Add
--scope-mode fullif you want that explicit. - A separate category. Give each workflow its own SARIF
categoryso PR and nightly results don't overwrite each other in code scanning.
Findings in GitHub code scanning
Strix writes findings.sarif (SARIF 2.1.0) into the run directory on every save, next to its CSV, Markdown and JSON reports. The v1.7.1 source notes that it always writes the file, even when empty, so a clean run tells code scanning that earlier alerts are fixed. Other details from the same file:
- Severity maps to GitHub's
security-severity, taken from CVSS when present. - Findings with a suggested fix carry SARIF
fixes. - Findings against a URL rather than a file, which is typical for staging scans, keep a logical location. Ones with no safe file path are anchored to
SECURITY.mdand flagged as a synthetic location, so expect some alerts to point there.
This is what makes a Strix GitHub Actions job useful to reviewers: findings show up next to the code in the pull request instead of in a log nobody opens. Uploading needs the security-events: write permission, and private repositories also need actions: read (GitHub docs). The upload uses continue-on-error: true so a refused upload does not fail an otherwise clean job. Keep the strix_runs/ artifact too. It holds the full Markdown write-ups with reproduction steps, which SARIF summarizes. strix view <run-name> serves a downloaded run in Strix's local dashboard.
Keys, cost and data for CI scans
Give CI its own keys. The workflows use two secrets, one per job. RedRouter's authentication docs let each key have a model allowlist, a lifetime or daily, weekly or monthly credit limit, and an expiry date. Limit the PR key to glm-5.3-flash-red with a small daily limit, and the nightly key to red-cyber-1. A leaked CI key then costs a capped amount and one rotation. Check a key's limits with GET /v1/key.
Price the model you pick. GLM 5.3 Flash Red (glm-5.3-flash-red) costs $0.25 per 1M input tokens, $0.10 per 1M cached input tokens and $1.00 per 1M output tokens, with a 1,048,576-token context window, tool calling and an 8,192-token default output (model page, pricing). That makes it a good fit for short PR scans. red-cyber-1 (Beta) is RedRouter's featured model for authorized penetration testing and red-team work, at $0.28, $0.10 and $1.10 per 1M tokens on the same basis (model page). Copy current prices from docs.redrouter.org/models into the STRIX_LLM_*_COST_PER_MTOK variables, or --max-budget will be off. Neither model was part of RedRouter's earlier Strix compatibility check, so run a short scan on a test repo first.
Decide what scan data leaves the runner. Strix sends source snippets, responses from your staging app and tool output to the model on every turn. Seed staging with fake data. On RedRouter, new API keys default to store_content: false. Account-wide zero data retention (ZDR) is a separate opt-in that is off by default; the data handling docs explain it, and what RedRouter keeps puts it in plain terms. The strix_runs/ artifact also holds full run data, so set a short artifact retention period.
Troubleshooting Strix in CI
| Symptom | Likely cause | Fix |
|---|---|---|
| Exit code 1 before any scanning | Missing STRIX_LLM or LLM_API_KEY (often a fork PR), or Docker unavailable | Check the if: guard and secrets. GitHub-hosted Ubuntu runners include Docker |
| Exit code 1 mentioning diff-scope | Shallow clone, so no merge base | Keep fetch-depth: 0, or pass --diff-base origin/main |
Strix can't reach localhost:8080 | Port published on 127.0.0.1 only, or the app wasn't ready | Publish "8080:8080"; use docker compose up -d --wait with a healthcheck |
| Scan touched a production host | The OpenAPI servers list included it | Rewrite servers to staging only before the scan |
--max-budget never stops the scan | No custom prices set for the model | Set all three STRIX_LLM_*_COST_PER_MTOK variables |
| Job runs for hours | No --scan-mode, so deep mode | Set quick for PRs and standard for nightly runs |
FAQ
Can Strix run in GitHub Actions?
Yes. The workflows above run pinned Strix 1.7.1 through uvx, with -n for headless mode. The runner needs Docker, which GitHub-hosted Ubuntu runners have. The job fails with exit code 2 when Strix reports findings at or above the --fail-on threshold.
Does Strix output SARIF?
Yes. Each run writes findings.sarif (SARIF 2.1.0) in strix_runs/<run-name>/, which you can upload with github/codeql-action/upload-sarif to show findings in GitHub code scanning.
How do I point Strix at a PR preview environment?
Pass the preview URL as a second --target next to the checked-out code, and list only that host in your scope file. If you also pass an OpenAPI spec, rewrite its servers list to the preview URL first, because Strix treats every absolute server URL in the spec as in scope.
Why does my Strix CI job fail on fork pull requests?
GitHub doesn't pass repository secrets to workflows from forks, so LLM_API_KEY is empty and Strix fails its startup checks. Skip fork PRs with an if: condition, or scan them after a maintainer merges or reviews them.
Which model should I use for Strix in CI?
Any model with tool calling that you've tested on your own repository. GLM 5.3 Flash Red suits short PR scans. red-cyber-1 (Beta) is RedRouter's featured model for authorized pentesting and fits longer scheduled scans. Set its prices so --max-budget works.
Sources
- Strix: repository, v1.7.1 release, CLI reference, GitHub Actions, CI/CD integration, scan modes, custom instructions, configuration, local viewer. Source files read at v1.7.1:
strix/interface/cli_args.py,strix/interface/scan_setup.py,strix/interface/utils.py,strix/utils/api_spec.py,strix/report/sarif.py,strix/runtime/docker_client.py,scripts/install.sh. Checked November 14, 2026. - GitHub Docs: Using secrets in GitHub Actions, Uploading a SARIF file to GitHub. Ubuntu 24.04 runner image contents.
- RedRouter Docs: Models and pricing, Authentication and API keys, Data handling. Checked November 14, 2026.