ScanSuite AI

Pipelines and API

Start and gate an AI Pentest from a CI job with scansuite-ci, or through the team API.

View as Markdown
ScanSuite AI

This page describes ScanSuite AI and its CI client 2.x (appsec4u/ai-ci:2). The ScanSuite Teams client is described in CI/CD and automation.

A pipeline can start an AI Pentest of a staging deployment, follow it to the end and fail the job on what it confirms. It uses a service account's API token, never a person's password, and the same checks as the AI Pentest page: every target must be allowed by the team's targets, and the safeguards apply as for a run started by hand.

One-time setup

  1. 01
    Create a service account

    Teams → your team → People → Automation and API tokens. Create an account such as ci with the role Operator.

  2. 02
    Issue a token

    With product.read, scan.execute, scan.read and finding.read; at most 90 days. The dialog shows the team's short name for pipelines and a ready-to-run --check command.

  3. 03
    Store it in the CI system

    SCANSUITE_TOKEN as a masked variable; SCANSUITE_URL and SCANSUITE_TEAM as plain variables; SCANSUITE_PRODUCT (exact name) or SCANSUITE_PRODUCT_ID.

  4. 04
    Test the connection
    Shell
    docker run --rm -e SCANSUITE_URL -e SCANSUITE_TEAM -e SCANSUITE_TOKEN appsec4u/ai-ci:2 --check

Store the token in the CI system's masked variables yourself; never paste it into a chat or a file in the repository.

Run a pentest from a job

Shell
scansuite-ci --scan-type pentest --target https://staging.example.com --cookie "session=$SESSION" --instructions "Focus on the checkout and the admin API" --fail-on-severity high
OptionVariableWhat it does
--scan-type pentestSCANSUITE_SCAN_TYPEAn AI Pentest instead of the default static scan.
--targetSCANSUITE_TARGETSA URL, host or network; repeat it or separate with commas. One kind per scan, as on the page.
--cookieCookies "key=value", several separated by ;
--headerRequest headers "Name: value", several separated by |
--instructionsThe focus text: guidance and rules for the agents.
--fail-on-severitySCANSUITE_FAIL_ON_SEVERITYFail the job on confirmed findings at or above this severity (default high; none turns it off).
--maxSCANSUITE_MAXAllowed findings per severity, for example high=0,medium=10.
--block-classSCANSUITE_BLOCK_CLASSFindings of these classes fail the job at any severity.
--junit, --sarif, --summary-jsonReports for the CI system.

The pentest's one scanner, ai_pentest_agent, is selected without --scanners. A server without the AI Pentest refuses the scan type. A target the team does not allow ends the job with exit code 3 and the reason; the secrets gate applies to static scans only.

Exit codes: 0 passed, 1 the gate failed, 2 the scan failed, 3 configuration or token error, 4 timeout, 5 server error. A pentest takes hours, not minutes: give the job a timeout to match the run time safeguard.

GitLab

Include the template your server serves at /ci/scansuite.gitlab-ci.yml and add a job after the deployment:

.gitlab-ci.yml
include:
  - remote: 'https://scansuite.example.com/ci/scansuite.gitlab-ci.yml'

scansuite-pentest:
  extends: .scansuite
  needs: []
  timeout: 4h
  variables:
    SCANSUITE_SCAN_TYPE: pentest
    SCANSUITE_TARGETS: https://staging.example.com
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Let an agent run a pentest of staging
Using the ScanSuite AI CI client (appsec4u/ai-ci:2) and the SCANSUITE_URL, SCANSUITE_TEAM and SCANSUITE_TOKEN variables already set in my environment, run --check, then start an AI Pentest of https://staging.example.com with --scan-type pentest and --fail-on-severity high. Follow it to the end and summarise the confirmed findings by severity, with the evidence for each High and Critical one. Do not change any safeguard and do not add targets.

Paste it into Claude Code or another coding agent. See Working with AI agents.

The team API

Every call goes to /api/teams/<team>/ with Authorization: Bearer <token>.

CallWhat it does
POST scans/pentestStart a pentest. JSON: product_id and targets (a list or a comma-separated string), optional header, cookie and instructions. An Idempotency-Key header makes a retry safe. Answers 202 with the job.
GET jobs/<job>The job and the scan it started.
GET scans/<scan>The scan and its status.
GET scans/<scan>/logsThe scan log.
GET scans/<scan>/findingsThe findings of the scan.
GET scans/<scan>/reportThe report.
POST scans/<scan>/cancelCancel the scan.
GET scannersWhat this server can run, per scan type.

The API starts one-time runs only; schedules are made on the AI Pentest page.

Last reviewed 2026-11-26