Integrations
Scan from a pipeline
A pipeline scans with the NightVision CLI. The CLI signs in with an API token, starts a scan of an application you have already set up, waits for it to finish, and exports the results in the format your tools read.
In the dashboard: SettingsIntegrationsPipelines
Open Pipelines (opens in a new tab)In the dashboard, the same summary is under Settings, Integrations, Pipelines.

How a pipeline scan works
Section titled “How a pipeline scan works”Every pipeline integration is the same three steps.
- Install the CLI on the runner. One download command for Linux runners. See Install the CLI.
- Give the pipeline an API token. Store it as a secret named
NIGHTVISION_TOKEN. The CLI reads that environment variable, so no login step is needed. - Run
nightvision scanwith the name of the application.
nightvision scan my-app --project my-project --auth my-app-loginThe CLI scans without signing in unless you pass --auth (or set NIGHTVISION_CREDS_ID), so name the authentication in every pipeline scan that needs a login. If the API issues short-lived tokens, see Authenticate an API in a pipeline.
Before the first run
Section titled “Before the first run”Set these up once, from the dashboard or from your own terminal. The pipeline reuses them on every run.
- An application. Create it under Applications, or run
nightvision target create my-app https://localhost:9000 --type API. Use--type WEBfor a web application. See Applications. - An authentication, if the application has a login. Record it once and pass its name with
--auth. See Recorded logins and Authentication. - An API token. In the dashboard, open Settings, Integrations, API tokens and select Generate API token. From a terminal, run
nightvision token create --expiry-date YYYY-MM-DDwith a date about 90 days out. A token acts as the account that made it, so create it from a dedicated CI account and always set an expiry date. A token without one never stops working. Give that account a role on the application’s project: Scan Operator works when the application was created from the same repository the pipeline checks out, and Project Manager is needed otherwise or if the job uploads a specification. See API tokens.
What the scan command does
Section titled “What the scan command does”- It looks for the application in the token account’s default project, which is often not the application’s project. Pass
--project my-projectwith the project’s name (or setNIGHTVISION_PROJECT_IDto its ID), as the examples here do, or the scan stops with an error that the application is not in the current project. - It runs for up to 30 minutes by default. Raise the limit with
--max-duration-minutes, from 30 up to 480. - If the application’s URL is not reachable from the internet (for example
https://localhost:9000on the runner), the CLI relays the scan traffic through the runner. You do not open any inbound ports. See Scan private networks. - When its output is redirected, the first line it prints is the scan ID. Progress and log lines go to standard error, so they still show in the job log.
nightvision scan my-app --project my-project --auth my-app-login > scan-results.txtSCAN_ID=$(head -n 1 scan-results.txt)Scan an API from its source code
Section titled “Scan an API from its source code”For an API, generate the OpenAPI specification from the code in the same job, before the scan. The CLI uploads the specification to the application, and the scan tests every route it found.
nightvision openapi extract . --target my-app --project my-project --lang javaThis step changes the application, because it uploads the specification, so the token needs the Project Manager role on the project. A Scan Operator token can start the scan and cannot run this step. See API tokens.
The specification is saved as openapi-spec.yml. Pass that file to an export command with --openapi-file and each finding carries the file and line that declares the vulnerable route. See Extract an OpenAPI specification and Code traceback.
Pick your CI
Section titled “Pick your CI”| CI system | What you get | Guide |
|---|---|---|
| GitHub Actions | Findings as code scanning alerts on the Security tab | GitHub Actions |
| GitLab CI/CD | Findings in the GitLab vulnerability report | GitLab |
| Azure DevOps | Findings on the build’s Scans tab, and optional work items | Azure DevOps |
| Bitbucket Pipelines | A scan on every push, with the SARIF file as an artifact | Bitbucket |
| Jenkins | Findings beside the source line, through the Warnings plugin | Jenkins |
| JFrog | Scan results and the API specification attached to an image as signed evidence | JFrog |
Any other CI system works the same way: install the CLI, set NIGHTVISION_TOKEN, run nightvision scan.
Gate a build
Section titled “Gate a build”On the scan itself
Section titled “On the scan itself”nightvision scan exits 0 when the scan completes. It exits non-zero when the scan fails, times out or is stopped, so the job fails and nobody reads a green build as a clean result.
A completed scan exits 0 whether or not it found anything. To fail the build on findings, count them in the export, as shown below.
On findings
Section titled “On findings”Export the scan to SARIF, leave out what should not block a build, and fail the job if anything is left.
nightvision export sarif -s "$SCAN_ID" \ --exclude-severity info,low \ --exclude-resolution false_positive,wont_fix
COUNT=$(jq '[.runs[].results[]] | length' results.sarif)if [ "$COUNT" -gt 0 ]; then echo "$COUNT findings at medium severity or higher" exit 1fi--exclude-severitytakes a comma-separated list ofinfo,low,medium,high,critical,unknownandunspecified.--exclude-resolutiontakesopen,resolved,false_positiveandwont_fix. Excludingfalse_positiveandwont_fixmeans a finding your team has already triaged in the dashboard stops blocking builds.
Both flags work on every export command.
On the login
Section titled “On the login”A scan whose login fails runs signed out and tests far less. Check the login first, in about two minutes, before you spend a full scan.
nightvision scan my-app --project my-project --auth my-app-login --login-check \ --validation-url https://localhost:9000/account--login-check runs only the login. It does not crawl and it runs no checks.
| Exit code | Meaning |
|---|---|
| 0 | The login works. With --validation-url, the session reached that page signed in. Without it, a session was captured. |
| 1 | The check could not finish: an infrastructure problem or a timeout. |
| 2 | The login failed. |
| 3 | Inconclusive. The session could not be confirmed either way. |
See Login check for the content and status-code options.
Send results onward
Section titled “Send results onward”Each export command takes the scan ID with -s.
| Command | Output | Use it for |
|---|---|---|
nightvision export sarif |
results.sarif |
GitHub code scanning, Azure DevOps, Jenkins, any SARIF reader |
nightvision export gitlab |
gl-dast-report.json |
The GitLab vulnerability report |
nightvision export csv |
results.csv |
Spreadsheets and your own scripts |
nightvision export jira |
Jira issues | One Jira issue per finding. See Jira |
Change the output path with -o. For PDF reports and exports from the dashboard, see Reports and exports.
To post a scan result to Slack or Microsoft Teams from the same job, see Notifications.
See pipeline runs in the dashboard
Section titled “See pipeline runs in the dashboard”A pipeline run is an ordinary scan. Open Scans and set the Trigger filter to CLI and pipelines, or select See pipeline and CLI runs on Scans on the Pipelines tab.
The CLI also prints a link to the scan in the job log, on the Link: line.
Next steps
Section titled “Next steps”- Pick a guide from Pick your CI. GitHub Actions and GitLab include a complete gated, authenticated workflow.
- Recorded logins and Headers and cookies cover the authentication a pipeline scan uses. For an API that issues short-lived tokens, see Authenticate an API in a pipeline.
- Read a scan and triage findings so triaged findings stop blocking builds.
- Notifications and Jira send results to your team.