Skip to content

Qualys Container Security Executor

Category: IaC, Containers and Kubernetes Script: qualys_container_security.py Integration: REST API Faraday Plugin: Raw JSON Website: https://www.qualys.com/apps/container-security/

Description

Imports the vulnerabilities of container images and running containers from Qualys Container Security into Faraday. Each image and each container becomes a Faraday host, with one [CNAPP] vulnerability per finding.

Prerequisites

  • A Qualys subscription with Container Security enabled
  • A Qualys user with access to Container Security (the same user and password used for the Qualys portal)
  • The Container Security gateway URL of your Qualys platform (e.g., https://gateway.qg2.apps.qualys.com for US2)

Configuration

Environment Variables (Setup)

Variable Required Description
QUALYS_HOST Yes Container Security gateway URL of your Qualys platform (e.g., https://gateway.qg2.apps.qualys.com or https://gateway.qg1.apps.qualys.eu). If you omit the scheme, https:// is used.
QUALYS_USER Yes Qualys user name. The older name QUALYS_USERNAME is also accepted.
QUALYS_PASSWORD Yes Qualys user password

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

Execution Arguments

Parameter Type Mandatory Description
QCS_REGISTRY string No Import only images and containers from this registry (e.g., docker.io). If empty, all registries are included.
QCS_REPO string No Import only images and containers from this repository (e.g., myorg/myapp). Can be combined with QCS_REGISTRY. If empty, all repositories are included.
QCS_MIN_SEVERITY string No Minimum severity to import: info, low, medium, high or critical (default: info)

YAML Configuration Example

executors:
  qualys_container_security:
    repo_executor: qualys_container_security.py
    max_size: 65536
    varenvs:
      QUALYS_HOST: "https://gateway.qg2.apps.qualys.com"
      QUALYS_USER: "<qualys_user>"
      QUALYS_PASSWORD: "<qualys_password>"
    params:
      QCS_REGISTRY:
        mandatory: false
        type: string
        base: string
      QCS_REPO:
        mandatory: false
        type: string
        base: string
      QCS_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string

How It Works

  1. Gets a token with POST /auth using the user name and password, and sends it as a Bearer token on the following requests
  2. Reads the images with GET /csapi/v1.3/images and then the running containers with GET /csapi/v1.3/containers, 50 per page. QCS_REGISTRY and QCS_REPO are sent as a Qualys query filter.
  3. Maps each vulnerability embedded in an image or container to a Faraday vulnerability:
    • Name: [CNAPP] followed by the vulnerability, the package and the image or container
    • Severity: Qualys scale 1-5 (1 info, 2 medium, 3 high, 4 and 5 critical), severity names, or the CVSS score
    • Status: open unless Qualys reports the finding as fixed or resolved
    • Details: CVEs, QID, CVSS data and references
  4. Drops findings below QCS_MIN_SEVERITY

Notes

  • Hosts use IP 0.0.0.0, because the findings belong to images and containers and not to IP addresses. Image hosts are named <registry>/<repo>:<tag>@<image id> and container hosts <name>@<container id>.
  • Images and containers without findings (after the severity filter) are not imported.
  • An unrecognized QCS_MIN_SEVERITY falls back to info.
  • TLS certificate verification is disabled for requests to the gateway.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use QCS_MIN_SEVERITY to filter by severity.