CI/CD Integration
Overview
Pensar provides a CLI tool and API for integrating automated pentesting directly into your CI/CD pipeline. Run pentests on every commit or deployment to catch vulnerabilities before they reach production.
Installation
Install the Pensar CI package globally:
Or add it as a dev dependency:
View the source code and additional examples on GitHub.
Configuration
Required Environment Variables
Optional Environment Variables
You can configure CI/CD integration directly from the Pensar Console. Navigate to your project’s Settings → CI/CD page for guided setup and one-click workflow creation.
CLI Usage
Run a Pentest
Options:
Examples:
Check Scan Status
Example:
CI/CD Examples
GitHub Actions
On Push
After Deployment
Run a pentest when commits are pushed to main branches:
GitLab CI
Add to your .gitlab-ci.yml:
Bitbucket Pipelines
Add to your bitbucket-pipelines.yml:
Exit Codes
By default, the CLI will exit with code 1 if any security issues are found. Use this to block deployments when vulnerabilities are detected.
API Reference
Dispatch Scan
Headers:
Authorization: Bearer <api_key>orx-api-key: <api_key>Content-Type: application/json
Request Body:
Response:
Get Scan Status
Headers:
Authorization: Bearer <api_key>orx-api-key: <api_key>
Response: