$ man netsekurity --cicd-integration
# pentest on every deploy — automated API integration for your CI/CD
01 · Quickstart
- Add & verify your domain — dashboard → add domain → add the TXT record → verify. The domain must be [verified].
- Generate an API token — dashboard → api tokens (CI/CD) → choose expiry (7/14/30/60/90 days) → generate. Copy it now (shown only once).
- Store as a secret in your CI — e.g. GitHub Actions
NETSEKURITY_API_TOKEN. - Call the endpoint on deploy. Done — Netsekurity queues and runs the pentest, then uploads the report.
curl -s -X POST https://netsekurity.com/api/v1/pentests \ -H "X-API-Token: $NETSEKURITY_API_TOKEN" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "domain=app.example.com&mode=standard" # standard = 1 credit · destructive = 2 credits (exploit/RCE/webshell — use a dev server)
02 · HTTP API Reference
| param | type | desc |
|---|---|---|
| X-API-Token | header | required — your API token |
| domain | form/JSON | required — verified domain owned by the token user |
| mode | form/JSON | standard (default, 1 credit) or destructive (2 credits) |
# 200 OK
{"pentest_id":"pt_1f2e…","domain":"app.example.com","mode":"standard","status":"queued"}
# 401 missing/invalid/expired token · 400 domain not verified · 402 insufficient credits
# 400 already queued/running (in-flight cap: 1 per user)
When a pentest finishes it sets status=completed and the report is
available on the dashboard (/reports/<name>.pdf, owner/admin only). Poll
/api/pentests/list or check the dashboard.
03 · GitHub Actions
name: pentest-on-deploy
on:
push:
branches: [ main, production ]
jobs:
nsk-pentest:
runs-on: ubuntu-latest
steps:
- name: Trigger Netsekurity pentest
run: |
curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: ${{ secrets.NETSEKURITY_API_TOKEN }}" \
-d "domain=app.example.com&mode=standard"
env:
NETSEKURITY_API_TOKEN: ${{ secrets.NETSEKURITY_API_TOKEN }}
Add NETSEKURITY_API_TOKEN under Settings → Secrets and variables → Actions.
04 · GitLab CI
# .gitlab-ci.yml
nsk-pentest:
stage: .post
image: alpine:latest
script:
- apk add --no-cache curl
- curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
only:
- production
environment: production
Add NETSEKURITY_API_TOKEN under Settings → CI/CD → Variables (Masked).
05 · Jenkins
pipeline {
agent any
environment {
NSK_TOKEN = credentials('nsk-api-token') // Secret text credential
}
stages {
stage('deploy') { steps { sh './deploy.sh' } }
stage('pentest') {
steps {
sh "curl -s -X POST https://netsekurity.com/api/v1/pentests " +
"-H 'X-API-Token: $NSK_TOKEN' " +
"-d 'domain=app.example.com&mode=standard'"
}
}
}
}
Create a Secret text credential named nsk-api-token.
06 · CircleCI
# .circleci/config.yml
version: 2.1
jobs:
pentest:
docker: [{ image: cimg/base:stable }]
steps:
- run:
name: Netsekurity pentest
command: |
curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
workflows:
version: 2
deploy-and-pentest:
jobs:
- pentest:
filters: { branches: { only: [production] } }
Add NETSEKURITY_API_TOKEN under Project → Settings → Environment Variables.
07 · Azure DevOps
# azure-pipelines.yml
trigger:
branches:
include: [ main ]
pool: { vmImage: ubuntu-latest }
variables:
NSK_TOKEN: $[variables.NETSEKURITY_API_TOKEN]
steps:
- script: |
curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $(NETSEKURITY_API_TOKEN)" \
-d "domain=app.example.com&mode=standard"
displayName: "Netsekurity pentest"
Add NETSEKURITY_API_TOKEN under Pipelines → Library → Variable group (keep secret).
08 · Bitbucket Pipelines
# bitbucket-pipelines.yml
pipelines:
branches:
main:
- step:
name: Netsekurity pentest
script:
- curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
Add NETSEKURITY_API_TOKEN under Repository → Settings → Pipelines → Repository variables (Secured).
09 · Travis CI
# .travis.yml
language: generic
script:
- ./deploy.sh
after_deploy:
- curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
branches: { only: [ master ] }
Add the encrypted secret via travis encrypt NETSEKURITY_API_TOKEN=xxx in .travis.yml.
10 · TeamCity
# Build step (Command Line): "Netsekurity pentest" curl -s -X POST https://netsekurity.com/api/v1/pentests \ -H "X-API-Token: %env.NSK_API_TOKEN%" \ -d "domain=app.example.com&mode=standard"
Define env.NSK_API_TOKEN in the build configuration (Parameters, Password type).
11 · Buildkite
# buildkite-agent pipeline
steps:
- label: "Netsekurity pentest"
command: |
curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
agents: { queue: default }
Add NETSEKURITY_API_TOKEN under Pipeline → Settings → Environment variables (secret).
12 · Codefresh & Semaphore
# codefresh (codefresh.yml)
version: "1.0"
steps:
nsk_pentest:
type: run
image: curlimages/curl:latest
commands:
- curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
# semaphore (semaphore.yml)
blocks:
- name: "Netsekurity pentest"
task:
jobs:
- name: pentest
commands:
- curl -s -X POST https://netsekurity.com/api/v1/pentests \
-H "X-API-Token: $NETSEKURITY_API_TOKEN" \
-d "domain=app.example.com&mode=standard"
Set NETSEKURITY_API_TOKEN in the pipeline environment (secret) in each tool.
13 · Destructive mode
DANGER.
Set mode=destructive (2 credits) to run active exploitation — RCE, webshell upload,
malware/exploit injection, takeover attempts. It may damage the target. Always point at a
development / staging server, never production, unless explicitly authorized.
curl -s -X POST https://netsekurity.com/api/v1/pentests \ -H "X-API-Token: $NETSEKURITY_API_TOKEN" \ -d "domain=staging.example.com&mode=destructive"
14 · Configuration & security notes
- Tokens expire — set an expiry that matches your deploy cadence; rotate regularly by generating a new token and revoking the old one.
- Store tokens as CI secrets — never commit them to source control.
- One token per user/pipeline is fine; revoke from the dashboard any time.
- In-flight cap — only 1 queued/running pentest per user at a time; the API returns an error if a scan is already active.
- Credits — standard pentest = 1 credit, destructive = 2 credits. Insufficient balance returns HTTP 402.