CI/CD integration

LIVE

Fail a build on vulnerable dependencies or known-exploited findings, with one CLI step or a short SDK script.

  • One step: npx @cyberspec/sdk deps --yes --fail-on high (CLI from 0.2.0, not yet on npm)
  • Works in any CI that runs Node.js 20, including GitHub Actions and GitLab CI
  • Exit 1 when this upload finds a vulnerability at or above your threshold; exit 2 when nothing was checked
  • SDK recipe, on npm today: start a scan, wait for it, fail on known-exploited or critical findings
  • Store the API key as a CI secret; scans only run against assets already verified in the portal
CyberSpec dashboard: risk score, open findings by severity, a seven-day trend and recent scans
The CyberSpec portal.

Two checks fit in a pipeline. The dependency CLI reads the lockfiles in the checkout and exits 1 when that upload contains a vulnerability at or above your chosen severity. The SDK can start a network scan of a verified asset, wait for it and fail the job on known-exploited or critical findings, for example after a deploy. The SDK recipe works with 0.1.0 from npm; the CLI needs 0.2.0, which is not published yet.

GitHub Actions (CLI from 0.2.0, not yet on npm)

Add CYBERSPEC_API_KEY as a repository secret. The first --yes belongs to npx and skips its install prompt; the second tells the CLI to send without asking, because a pipeline cannot answer the prompt. Secrets are not passed to workflows triggered from forks, so the step fails there with exit code 2.

# .github/workflows/dependencies.yml
name: dependencies
on: [push, pull_request]

jobs:
  cyberspec:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npx --yes @cyberspec/sdk deps --name acme/web --yes --fail-on high
        env:
          CYBERSPEC_API_KEY: ${{ secrets.CYBERSPEC_API_KEY }}

GitLab CI

Any job on a Node.js 20 image works. Set CYBERSPEC_API_KEY as a masked CI/CD variable. The CLI needs an Owner or Admin key, because the first run for a codebase adds it as an asset on your plan.

# .gitlab-ci.yml
dependencies:
  image: node:20
  script:
    - npx --yes @cyberspec/sdk deps --name acme/web --yes --fail-on high
  # CYBERSPEC_API_KEY: a masked CI/CD variable in Settings → CI/CD → Variables

Exit codes

--fail-on counts every vulnerable package found in this upload, including ones someone has marked as risk accepted in the portal. To let the build pass, upgrade the package or raise the threshold. A repository with no supported lockfile exits 2, so leave the step out of those pipelines.

0  Sent and checked; nothing at or above --fail-on in this upload
   (also: no --fail-on given, --help, or you answered N at the prompt)
1  --fail-on was set and this upload found a vulnerability at or above it
2  Nothing checked: bad arguments, CYBERSPEC_API_KEY missing, an unusable
   --name, a lockfile that failed to parse, no lockfiles found, no terminal
   and no --yes, or the API refused the request

Fail on known-exploited findings after a deploy

This uses the SDK on npm today (0.1.0). It scans an asset you have already verified in the portal, waits for the scan, and fails the job on any open finding that is on CISA’s Known Exploited Vulnerabilities catalog or rated critical. scans.wait polls every 10 seconds and gives up after an hour by default. A full scan covers every port and takes longer than a quick one.

import { CyberSpec } from '@cyberspec/sdk';

const cs = new CyberSpec({ apiKey: process.env.CYBERSPEC_API_KEY });

const scan = await cs.scans.create({ assetIds: ['<asset id>'], type: 'quick' });
const done = await cs.scans.wait(scan._id);
if (done.status !== 'completed') throw new Error(`Scan ${done.status}: ${done.error}`);

for await (const f of cs.findings.all({ scanId: done._id, status: 'open' })) {
  if (f.kev || f.severity === 'critical') {
    console.error(`${f.cve ?? f.checkKey} on ${f.hostPort}: ${f.remediation}`);
    process.exitCode = 1;
  }
}

Where this sits next to Cyber Essentials

The post-deploy network scan feeds the Cyber Essentials readiness view, which reads what the CE Plus external test would likely find. Dependency findings from the CLI are kept out of it, because that test does not see your lockfiles. Readiness is not certification: IASME and its certification bodies certify.

The parts of CyberSpec that do this

For teams in United Kingdom

UK buyers usually ask two things: are we ready for Cyber Essentials, and can we show UK GDPR Article 32 security? CyberSpec reads the internet-facing part of both from live scans, as readiness and evidence. The certification body makes the Cyber Essentials call.

CyberSpec is £15 per client a month for up to 5 assets, a £100 one-off report, or free for one asset.

See your own exposure in minutes

Free for one asset, no card. Add a domain, prove you own it, and run your first scan.

More in Developers