Humanbound website

How to Add an AI Security Check to Your GitHub Actions Workflow

SA
Sofia Aliferi
Sep 17, 20264 min read
Techy cover for the Humanbound Agent Attack Scenario Library, showing a test_pack.yaml code card that maps an agent failure to an OWASP Agentic category and the guardrail that closes it, with Agent Goal Hijack, Tool Misuse, and Memory Poisoning tags.

Humanbound has an official GitHub Action, humanbound/actions, that runs adversarial security tests against an AI agent inside a GitHub Actions workflow and fails the build when findings cross a severity threshold you set. It wraps the same OWASP-aligned testing engine as the hb test CLI command and uploads results to GitHub's native Security tab as SARIF, so a jailbreak shows up as a code scanning alert, not a separate report nobody opens.

Why gate a build on agent security at all?

Almost no CI pipeline today fails a build because an AI agent can be jailbroken, even though the same pipeline already fails on a broken unit test or a linting error. Most teams shipping agents have a CI process gating dependency vulnerabilities and code quality, but the agent itself gets its first real adversarial test from a user finding the hole in production. GitHub Actions is the natural place to close that gap, since it's already where most of these builds run.

How does the GitHub Action gate a build?

The humanbound/actions Action installs the Humanbound CLI, runs adversarial tests against your agent's endpoint, and fails the workflow when a finding matches the severity threshold you specify:

Loading code editor...

fail-on accepts critical, high, medium, low, or any. A build that trips the threshold fails the same way a broken unit test would, and findings land in GitHub's Security tab as SARIF with a severity summary on the run page, so nobody has to leave GitHub to see what broke.

What happens if the scan itself fails?

hb test exits with code 2, not 0, if the scan itself fails, distinct from exit code 1 for a normal fail-on match. This distinction matters because without it, a broken scan (bad endpoint config, expired API key, agent never came up) would silently exit 0 and read as a clean pass. Exit code 2 covers a run that ended with status Failed, or one where every conversation errored so nothing was actually tested. A security gate that a broken scan can quietly satisfy is not a security gate.

Local mode vs platform mode: which should you use?

Local mode needs nothing but your own LLM provider key; platform mode adds a persistent Humanbound dashboard on top of the same test. The Action runs one of two ways depending on which credential you set:

  • Local mode — set provider-api-key (your own LLM key). It runs in the runner and produces job output plus SARIF, no account needed.
  • Platform mode — set api-key (a Humanbound hb_… key). It runs on humanbound.ai and produces your dashboard, plus SARIF.

Local mode is the zero-signup path: a workflow file and an API key a team already has. Platform mode is worth it once you want posture trending across builds instead of a single pass/fail per pull request.

Does this work outside GitHub?

Yes. For GitLab, Jenkins, CircleCI, or any other CI system, the same test runs via the hb CLI directly or the official ghcr.io/humanbound/humanbound Docker image, with no Python install needed on the runner:

Loading code editor...

The GitHub Action is the polished, zero-config path. The underlying mechanism, and the guarantee that a broken scan can't pass, is identical everywhere.

How do I add this to an existing pipeline?

  1. humanbound/actions@v1 added to the same pull request workflow that already runs tests and linting.
  2. fail-on: high (or whatever threshold matches your risk tolerance) set so the build fails the same way any other broken check does.
  3. Findings reviewed in the Security tab alongside existing dependency and code scanning alerts, one place, not a separate login.
  4. A move to platform mode later, if posture trending across builds matters more than a per-PR pass/fail.

FAQ

Is there an official GitHub Action for Humanbound?

Yes. humanbound/actions wraps hb test: it installs the CLI, runs the adversarial scan, gates the build with fail-on, and uploads findings to the GitHub Security tab as SARIF. Reference it in a workflow as uses: humanbound/actions@v1.

What does the fail-on flag do?

It causes the scan to exit with a non-zero status when vulnerabilities at or above the specified severity are found. The thresholds are critical, high, medium, low, and any, so a team can tune how strict the security gate is.

Does the GitHub Action require a Humanbound account?

No. Local mode runs entirely on a provided LLM provider key (provider-api-key) with no sign-up. Platform mode adds a Humanbound api-key for a persistent dashboard, but it's optional.

Can this run somewhere other than GitHub Actions?

Yes. The same hb test engine runs on GitLab CI, Jenkins, CircleCI, or any CI system, either via the CLI directly or the official ghcr.io/humanbound/humanbound Docker image.

Sources

About the author

SA
Sofia Aliferi

Working on growth and community at Humanbound, an AI security testing platform helping enterprises secure their AI agents.