Blog··7 min read

DarkMoon in Jenkins: a pipeline step that gates the build on real findings

A darkmoonScan() pipeline step that wraps the DarkMoon CLI on the agent, fails or marks the build unstable from the severity summary, maps findings to SARIF 2.1 for Warnings Next Generation, and keeps the token in the Jenkins Credentials store, never on the command line.

Watch the tutorial · Darkmoon + Jenkins: Add AI Security Testing to Your Builds

CI is where security either becomes routine or stays a quarterly event. The DarkMoon Jenkins plugin adds a single pipeline step that runs an autonomous assessment on the agent and gates the build on what it actually finds, not on a scanner exit code.

One step

The plugin exposes a darkmoonScan(...) step. A minimal declarative usage:

stage('Pentest') {
  steps {
    darkmoonScan(
      target: 'https://staging.example.com',
      mode: 'pro',
      apiUrl: 'https://darkmoon.internal',
      credentialsId: 'darkmoon-token',
      failOn: 'critical,high',
      recordIssues: true,
      archiveReport: true
    )
  }
}

The step wraps the portable darkmoon-ci CLI on the agent (Node 18+). It launches and waits, reads the fail verdict and campaign id, then pulls findings, the severity summary and the report.

Gate the build from the severity summary

The build result is set from the finding severities, not from CLI exit codes: failOn marks the build a failure, unstableOn marks it unstable. A run that never completes within timeout is a failure, never a silent pass.

DarkMoon Pro findings list for a demo campaign against DVGA, an intentionally vulnerable GraphQL app, on synthetic demo data: 68 vulnerabilities with severity and proof filters (exploited, confirmed, unconfirmed), and rows such as remote code execution and SQL injection, each with a CVSS bar, an Exploited status, its treatment-plan action and a link to the attack path it sits on.
The finding severities the gate reads, as a campaign's findings appear in the DarkMoon Pro web app. Synthetic demo data (demo.dark-moon.org) on the DVGA demo lab.Captured 22 November 2026 from demo.dark-moon.org.

SARIF for Warnings Next Generation

Findings are mapped to SARIF 2.1.0 (darkmoon-reports/darkmoon.sarif) so the Warnings Next Generation plugin renders the severity donut, the trend and per-issue detail in the build view. The report, the SARIF file and the CLI log are archived as build artifacts.

DarkMoon Pro finding detail on synthetic demo data: an exploited, critical SQL injection in the pastes(filter) parameter of the DVGA demo lab (CVSS 9.8), with the asset tree on the left, the description and the evidence the testing agent recorded in the centre, and a details rail with identifier, CVSS vector, endpoint, agent and first and last seen times.
One finding in the DarkMoon Pro web app, with its evidence, CVSS vector and endpoint: the kind of record each SARIF issue is mapped from. Synthetic demo data (demo.dark-moon.org) on the DVGA demo lab.Captured 22 November 2026 from demo.dark-moon.org.

Secrets never on the command line

The Pro token or license is read from the Jenkins Credentials API and passed to the CLI through environment variables (DARKMOON_PRO_TOKEN, DARKMOON_LICENSE), never on the command line, the console, or in artifacts. Pro authentication is token-only by design.

Auto or OSS or Pro

The mode parameter selects auto-detect, the open-source CLI reading a local data directory, or the Pro API. The same step works in all three, so a team can start on OSS and move to Pro without rewriting the pipeline.

The plugin targets Jenkins 2.479+ on JDK 17 and ships an .hpi via Releases. See the integrations catalog and the GitLab component for the same idea on another CI system.

Next
Run it against your own lab

Darkmoon is open source (AGPL-3.0) and self hosted. Clone it, point it at a target you own, and read every line.