Skip to main content
This guide shows you how to run CybeDefend local scans within a GitLab Self-Managed environment. It’s ideal if you want to keep your code in-house and still benefit from automated security checks.

Prerequisites

  1. Personal Access Token (PAT)
    Ensure you’ve already created a PAT in the CybeDefend dashboard. If not, see Personal Access Tokens (PAT).
  2. CybeDefend CLI
    You can either install the CLI directly in your job container or use a Docker image containing the CLI.
The —ci flag in CybeDefend’s CLI disables colors and fancy formatting, providing minimal, script-friendly output.

Example .gitlab-ci.yml

Key Points

  • Use the “security-scan” stage or any custom stage relevant to your pipeline.
  • Install CLI: Basic curl commands to grab the binary.
  • Run the scan: Provide --dir . to scan current working directory.
  • Env Variables: $CYBEDEFEND_PAT and $CYBEDEFEND_PROJECT_ID are stored in GitLab’s CI/CD Variables.

If you prefer Docker-based scanning, create or pull an image with cybedefend pre-installed, then run the scan inside a container in your pipeline.


Viewing Results

After the job completes, you can:
  • Check the CLI output for immediate details.
  • Use the CLI ‘results’ command to fetch a more comprehensive vulnerability listing:
  • Visit CybeDefend Dashboard to see a full breakdown of vulnerabilities found during each pipeline run.
For large codebases, consider caching dependencies to speed up builds – your security scans will remain unaffected as long as you keep scanning the final code or artifact.