Skip to content

GitLab Security Dashboard Executor

Category: Source Code Analysis Script: gitlab_security.py Integration: REST API Faraday Plugin: Raw JSON Website: https://docs.gitlab.com/ee/user/application_security/

Description

Imports security findings from the GitLab Vulnerability Report (SAST, dependency scanning, container scanning, secret detection, DAST and fuzzing) into Faraday. Each GitLab project becomes a Faraday host, and each finding becomes a vulnerability with its location, scanner, CVEs, CWEs and solution.

Prerequisites

  • A GitLab instance (GitLab.com or self-managed) with security scanning enabled on the projects to import
  • A personal, project or group access token with the read_api scope, from a user with at least the Reporter role on the projects
  • Network access from the agent to the GitLab URL

Configuration

Environment Variables (Setup)

Variable Required Description
GITLAB_HOST Yes GitLab base URL (e.g., https://gitlab.com or https://gitlab.example.com)
GITLAB_TOKEN Yes GitLab access token. It is sent in the PRIVATE-TOKEN header. A value starting with Bearer is sent as an OAuth2 Authorization header instead.

These variables are also accepted as execution arguments, so a single run can override them.

Execution Arguments

Parameter Type Mandatory Description
GITLAB_PROJECT_ID string No ID or URL-encoded path (e.g., mygroup%2Fmyrepo) of a single project to import. If empty, imports every non-archived project the token is a member of.
GITLAB_MIN_SEVERITY string No Minimum severity to import: info, low, medium, high or critical (default: info)
GITLAB_REPORT_TYPE string No Import only one report type: sast, dependency_scanning, container_scanning, secret_detection, dast, api_fuzzing or coverage_fuzzing (default: all)

YAML Configuration Example

executors:
  gitlab_security:
    repo_executor: gitlab_security.py
    max_size: 65536
    varenvs:
      GITLAB_HOST: "https://gitlab.com"
      GITLAB_TOKEN: "<gitlab_token>"
    params:
      GITLAB_PROJECT_ID:
        mandatory: false
        type: string
        base: string
      GITLAB_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string
      GITLAB_REPORT_TYPE:
        mandatory: false
        type: string
        base: string

How It Works

  1. Gets the project from /api/v4/projects/{id}, or lists the token's projects with /api/v4/projects?membership=true
  2. For each project, reads /api/v4/projects/{id}/vulnerability_findings, 100 per page, filtered by report type and severity
  3. Maps each finding to a Faraday vulnerability:
    • Name: the finding name with a prefix for its report type ([SAST], [SCA], [CONTAINER], [SECRETS], [DAST], [API-FUZZ], [COV-FUZZ])
    • Severity: GitLab's severity (unknown becomes info), or the CVSS score when there is no severity
    • Status: detected/confirmed become open, resolved becomes closed, dismissed and false positives become risk-accepted
    • Description: the location (file and line, package and version, image or URL), scanner and confidence
    • References: CVEs, CWEs, GHSA and OWASP identifiers and the finding's links
  4. Groups the findings of each project under one host and sends them to Faraday

Notes

  • Each project becomes one host with IP 0.0.0.0 and the project path (e.g., mygroup/myrepo) as hostname. Projects without findings are not created.
  • A 401 response stops the run. Projects that return 403 or 404 are skipped and written to the agent log.
  • An unrecognized GITLAB_MIN_SEVERITY value falls back to info. An unknown GITLAB_REPORT_TYPE is sent to GitLab as is.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use GITLAB_MIN_SEVERITY to filter by severity.