CI/CD Integrations
GitLab Self-Managed Setup for Local Code Scanning
Integrate the CybeDefend CLI into a GitLab Self-Managed CI/CD pipeline for secure local code scanning.
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
- API Key
Ensure you’ve already created an API key in the CybeDefend dashboard. If not, see Introduction & API Key Creation. - 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_API_KEY
and$CYBEDEFEND_PROJECT_ID
are stored in GitLab’s CI/CD Variables.
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.