Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0xSteph Pentest ai CI CD Security Gate Principle

From Leeroopedia
Knowledge Sources
Domains Security_Testing, CI_CD, DevSecOps
Last Updated 2026-10-23 12:00 GMT

Overview

A security-gate pattern that runs a penetration test as a CI/CD step, gates builds on verified findings using severity thresholds, and exports results as SARIF for code-scanning integration.

Description

CI/CD Security Gate is the principle that dynamic security testing can gate software builds the same way unit tests do: run the test, count findings at or above a severity threshold, and fail the build if any meet the gate. It solves the problem that security testing is often a manual, after-the-fact activity rather than a continuous integration step.

The gate operates on verified findings only (when using `--fail-on verified`) so that false positives from scanners cannot block a build. The CI mode outputs JSON to stdout for machine consumption and uses exit codes (0 = clean, 1 = gated).

The gate integrates with CI platforms:

  • SARIF export: Verified findings → SARIF v2.1.0 JSON with webRequest/webResponse for DAST, consumed by GitHub Code Scanning
  • GitHub Actions: Step outputs written to GITHUB_OUTPUT, PR comment posted via GitHub API
  • AUP gate: `PENTEST_AI_AUP_ACCEPTED=1` enables non-interactive consent for CI

Usage

Use this principle when:

  • Security testing should be a CI step, not a manual activity
  • Builds should fail on verified high-severity findings but not on scanner false positives
  • You need SARIF output for GitHub Code Scanning or Azure DevOps integration
  • You want to post security results as PR comments

Theoretical Basis

The gate is a threshold function on verified findings:

gate(findings,threshold)={fail (exit 1)if ∃f∈findings:severity(f)≤thresholdpass (exit 0)otherwise

SARIF is a standardized results interchange format:

# Abstract SARIF structure (NOT real implementation)
sarif = {
    "$schema": "https://...sarif-schema-2.1.0.json",
    "version": "2.1.0",
    "runs": [{
        "tool": {"driver": {"name": "pentest-ai", ...}},
        "results": [...],  # one per finding
        "invocations": [{...}],
    }]
}

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment