Skip to content

JFrog Xray Executor

Category: Software Composition Analysis Script: jfrog_xray.py Integration: REST API Faraday Plugin: Raw JSON Website: https://jfrog.com/xray/

Description

Imports the Xray vulnerability findings of one JFrog Artifactory artifact or build into Faraday. Each finding becomes a Faraday vulnerability, with its CVEs, CVSS data, affected component and fix versions.

Prerequisites

  • A JFrog platform with Xray, reachable from the agent
  • A JFrog user with permission to read Xray data for the repository or build. The password, API key or identity token of that user is used as the secret.
  • The Artifactory repository must be indexed by Xray

Configuration

Environment Variables (Setup)

Variable Required Description
XRAY_BIN_MGR_ID No Binary manager ID used to look up the repository (default: default). Only read as an environment variable.
XRAY_HOST Yes JFrog platform URL (e.g., https://yourco.jfrog.io). /xray is appended automatically if missing.
XRAY_USER Yes JFrog username
XRAY_API_KEY Yes API key, identity token or password of the user. A value starting with Bearer is sent as a bearer token instead.

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

Execution Arguments

Parameter Type Mandatory Description
XRAY_REPO string Yes Artifactory repository key (e.g., libs-release-local, docker-prod)
XRAY_PATH string Yes Path of the artifact inside the repository (e.g., org/example/lib/1.0/lib-1.0.jar). To import a build, use build:<name>:<number> (e.g., build:my-build:42) or <name>#<number>.
XRAY_MIN_SEVERITY string No Minimum severity to import: info, low, medium, high or critical (default: info)

YAML Configuration Example

executors:
  jfrog_xray:
    repo_executor: jfrog_xray.py
    max_size: 65536
    varenvs:
      XRAY_HOST: "https://yourco.jfrog.io"
      XRAY_USER: "<xray_user>"
      XRAY_API_KEY: "<xray_api_key>"
    params:
      XRAY_REPO:
        mandatory: true
        type: string
        base: string
      XRAY_PATH:
        mandatory: true
        type: string
        base: string
      XRAY_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string

How It Works

  1. Authenticates with HTTP Basic using XRAY_USER and XRAY_API_KEY
  2. Calls GET /api/v1/binMgr/{id}/repositories to read the repository metadata (package type, repository type), which is added to the host description
  3. For a build, calls POST /api/v1/summary/build. For an artifact, calls POST /api/v1/vulnerabilities and falls back to POST /api/v1/summary/artifact if that endpoint is not available.
  4. Maps each issue to a Faraday vulnerability:
    • Name: [SCA] plus the issue summary and the affected component
    • Severity: Xray's severity, or the CVSS score when Xray gives no usable severity
    • Status: open, closed (fixed/resolved) or risk-accepted (ignored/suppressed/not applicable)
    • Resolution: fixed versions and remediation advice
    • References: CVEs, CWEs and links
  5. Drops issues below XRAY_MIN_SEVERITY and groups the rest under one host

Notes

  • The executor creates a single host per run with IP 0.0.0.0. Its hostname is <repo>/<path>, or build:<name>#<number> for builds.
  • No host is created when no issue passes the severity filter.
  • Setup variables can also be passed as execution arguments. XRAY_REPO, XRAY_PATH and XRAY_MIN_SEVERITY are execution arguments only.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use XRAY_MIN_SEVERITY to filter by severity.
  • An unrecognized XRAY_MIN_SEVERITY falls back to info.