{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://relgap.sasskovacs.dev/schemas/outdated-v1.json",
  "title": "relgap outdated --format json",
  "description": "The report-v1.json envelope with outdated data: every resolved pin of the project compared with the latest version of its tool, sorted by tool, repo, file and line.",
  "allOf": [{ "$ref": "report-v1.json" }],
  "properties": {
    "data": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repos", "pins"],
      "properties": {
        "repos": {
          "description": "Scanned repository directories, slash-separated.",
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "pins": { "type": "array", "items": { "$ref": "#/$defs/pin" } },
        "unchecked": {
          "description": "Tool versions OSV wasn't asked about, grouped by tool, version and reason, with the pins that resolve to no tool last. Never reported as clean. Empty when every pin was checked.",
          "type": "array",
          "items": { "$ref": "#/$defs/unchecked" }
        },
        "binaries": {
          "description": "With --binaries: the Go executables of the pinned tools and the OSV vulnerabilities of the Go version and main module they were built with. Matched by version only, without symbol reachability.",
          "type": "array",
          "items": { "$ref": "#/$defs/binary" }
        }
      }
    }
  },
  "$defs": {
    "count": { "type": "integer", "minimum": 0 },
    "pin": {
      "type": "object",
      "additionalProperties": false,
      "required": ["tool", "pin", "status"],
      "properties": {
        "tool": { "description": "The pin's tool, as relgap digest accepts it.", "type": "string", "minLength": 1 },
        "repo": {
          "description": "Repository of the tool: GitHub owner/repo, or the project path on host. Absent when the pin was skipped or for an image without a GitHub source.",
          "type": "string",
          "minLength": 1
        },
        "host": { "description": "Host of repo when it isn't github.com: bitbucket.org, gitlab.com or a self-managed GitLab host.", "type": "string", "minLength": 1 },
        "pin": { "$ref": "pins-v1.json#/$defs/pin" },
        "current": { "description": "The version the pin stands for.", "type": "string", "minLength": 1 },
        "via": {
          "description": "How a non-exact pin became current.",
          "enum": [
            "highest installed or locked version",
            "lowest satisfying version",
            "highest stable version with this prefix",
            "latest channel"
          ]
        },
        "latest": { "description": "Newest stable version on the tool's release line.", "type": "string", "minLength": 1 },
        "behind": {
          "description": "Distance from current to latest, counted over the versions of the digest current..latest.",
          "type": "object",
          "additionalProperties": false,
          "required": ["releases", "major", "minor", "patch"],
          "properties": {
            "releases": { "description": "Stable versions after current up to latest.", "$ref": "#/$defs/count" },
            "major": { "description": "Newer major lines among them.", "$ref": "#/$defs/count" },
            "minor": { "description": "Newer minor lines among them.", "$ref": "#/$defs/count" },
            "patch": { "description": "Those on current's own minor line.", "$ref": "#/$defs/count" },
            "since": { "description": "When the first of them was published. Absent for tag-only tools.", "type": "string", "format": "date-time" }
          }
        },
        "counts": {
          "description": "Entries of the digest current..latest at or above the minimum confidence, per kind. Present when the pin was compared.",
          "type": "object",
          "additionalProperties": false,
          "required": ["breaking", "deprecation", "security", "feature", "fix", "other"],
          "properties": {
            "breaking": { "$ref": "#/$defs/count" },
            "deprecation": { "$ref": "#/$defs/count" },
            "security": { "$ref": "#/$defs/count" },
            "feature": { "$ref": "#/$defs/count" },
            "fix": { "$ref": "#/$defs/count" },
            "other": { "$ref": "#/$defs/count" }
          }
        },
        "hidden": { "description": "Entries below the minimum confidence.", "$ref": "#/$defs/count" },
        "status": {
          "description": "current, outdated, unknown (a channel other than latest, or a value no version matches), skipped (no GitHub repository relgap can read) or error.",
          "enum": ["current", "outdated", "unknown", "skipped", "error"]
        },
        "note": { "description": "Why the pin is unknown, skipped or failed.", "type": "string", "minLength": 1 },
        "eol": {
          "description": "End-of-life state on endoflife.date of the current version's cycle and of the latest version's. Absent when the tool has no endoflife.date product or endoflife.date failed.",
          "type": "object",
          "additionalProperties": false,
          "required": ["product", "current"],
          "properties": {
            "product": { "type": "string", "minLength": 1 },
            "current": { "$ref": "#/$defs/eolStatus" },
            "target": { "$ref": "#/$defs/eolStatus" }
          }
        },
        "vulns": {
          "description": "OSV vulnerabilities of the current version, or of the pinned version when an exact pin's lookup failed. Empty when OSV has none; absent when OSV wasn't asked (see unchecked).",
          "type": "array",
          "items": { "$ref": "#/$defs/vuln" }
        },
        "unchecked": { "$ref": "#/$defs/reason" },
        "fix": { "$ref": "#/$defs/fix" }
      }
    },
    "fix": {
      "description": "The release the version can move to: the lowest stable release above it that every advisory with a fix has left behind and that has no fixable advisory of its own. Absent without a vulnerability, or when the version list or OSV failed.",
      "type": "object",
      "additionalProperties": false,
      "required": ["latest", "latest_affected"],
      "properties": {
        "lowest": { "description": "Absent when no release qualifies.", "type": "string", "minLength": 1 },
        "lowest_in_line": { "description": "The same within the current version's line: its major, or major.minor for tools with version.line minor.", "type": "string", "minLength": 1 },
        "latest": { "description": "The newest stable release.", "type": "string", "minLength": 1 },
        "latest_affected": { "description": "Whether OSV lists an advisory for latest.", "type": "boolean" },
        "latest_affected_by": { "description": "The advisories OSV lists for latest.", "type": "array", "items": { "type": "string", "minLength": 1 } },
        "unfixed": { "description": "Advisories of the current version that latest still has: no release fixes them.", "type": "array", "items": { "type": "string", "minLength": 1 } }
      }
    },
    "reason": {
      "description": "Why OSV wasn't asked about a pin: no-advisory-source (no curated osv list and no backend or repository OSV knows), private-source (a host or registry relgap never sends to OSV), not-exact (the pin resolves to no single version), unresolved (no tool), offline (--offline and no cached answer), failed (the lookup or OSV failed; the envelope's errors say why).",
      "enum": ["no-advisory-source", "private-source", "not-exact", "unresolved", "offline", "failed"]
    },
    "unchecked": {
      "type": "object",
      "additionalProperties": false,
      "required": ["tool", "version", "reason", "pins"],
      "properties": {
        "tool": {
          "description": "The pins' tool, or the name as written for a pin that resolves to no tool.",
          "type": "string",
          "minLength": 1
        },
        "version": {
          "description": "The version OSV would be asked about, else the pin's value as written.",
          "type": "string"
        },
        "reason": { "$ref": "#/$defs/reason" },
        "pins": { "type": "array", "minItems": 1, "items": { "$ref": "pins-v1.json#/$defs/pin/properties/location" } }
      }
    },
    "eolStatus": {
      "type": "object",
      "additionalProperties": false,
      "required": ["version", "cycle"],
      "properties": {
        "version": { "type": "string", "minLength": 1 },
        "cycle": { "description": "The release cycle, from the registry's cycle template.", "type": "string", "minLength": 1 },
        "is_eol": { "description": "Absent when endoflife.date doesn't list the cycle.", "type": "boolean" },
        "eol_from": { "description": "Date the cycle reaches or reached its end.", "type": "string", "format": "date" },
        "latest_in_cycle": { "type": "string", "minLength": 1 },
        "note": { "type": "string", "minLength": 1 }
      }
    },
    "osvPackage": {
      "type": "object",
      "additionalProperties": false,
      "required": ["ecosystem", "name"],
      "properties": {
        "ecosystem": { "type": "string", "minLength": 1 },
        "name": { "type": "string", "minLength": 1 }
      }
    },
    "vuln": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "package", "affects_current"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "aliases": { "type": "array", "items": { "type": "string", "minLength": 1 } },
        "summary": { "type": "string" },
        "package": { "$ref": "#/$defs/osvPackage" },
        "severity": {
          "description": "The highest CVSS base score among the record's vectors, or only the advisory's own rating. A record with neither takes the highest score of its GHSA aliases, named in from. Without any, the rating is unknown, which every --vuln-severity counts.",
          "type": "object",
          "additionalProperties": false,
          "required": ["rating"],
          "properties": {
            "score": { "type": "number", "minimum": 0, "maximum": 10 },
            "rating": { "enum": ["none", "low", "medium", "high", "critical", "unknown"] },
            "vector": { "type": "string", "minLength": 1 },
            "from": { "description": "The GHSA alias the score comes from.", "type": "string", "pattern": "^GHSA-" }
          }
        },
        "fixed_in": { "description": "Lowest fixed version above the current one.", "type": "string", "minLength": 1 },
        "affects_current": { "type": "boolean" },
        "fixed_by_target": { "description": "Whether the latest version is outside every affected range. Absent without a target or when the ranges can't be compared locally.", "type": "boolean" },
        "suppressed": { "$ref": "#/$defs/suppression" },
        "kev": { "$ref": "#/$defs/kev" },
        "epss": { "$ref": "#/$defs/epss" }
      }
    },
    "kev": {
      "description": "With --kev: the advisory's entry in the CISA Known Exploited Vulnerabilities catalog, from its CVE alias. Absent when no CVE alias is listed or the catalog failed.",
      "type": "object",
      "additionalProperties": false,
      "required": ["cve", "date_added", "due_date", "ransomware"],
      "properties": {
        "cve": { "description": "The CVE alias the catalog lists; the earliest added when it lists several.", "type": "string", "pattern": "^CVE-" },
        "date_added": { "description": "When CISA added it to the catalog.", "type": "string", "format": "date" },
        "due_date": { "description": "The remediation deadline for US federal agencies.", "type": "string", "format": "date" },
        "ransomware": { "description": "Whether CISA knows of its use in ransomware campaigns.", "type": "boolean" }
      }
    },
    "epss": {
      "description": "With --epss: the FIRST EPSS score of the advisory's CVE alias, the highest when several have one. Absent when EPSS scores none or failed.",
      "type": "object",
      "additionalProperties": false,
      "required": ["cve", "score", "percentile", "date"],
      "properties": {
        "cve": { "type": "string", "pattern": "^CVE-" },
        "score": { "description": "Probability of exploitation in the next 30 days.", "type": "number", "minimum": 0, "maximum": 1 },
        "percentile": { "description": "Share of scored CVEs with this score or lower.", "type": "number", "minimum": 0, "maximum": 1 },
        "date": { "description": "The day EPSS computed the score.", "type": "string", "format": "date" }
      }
    },
    "suppression": {
      "description": "Why an advisory doesn't count: a vulns.ignore entry (kind ignore) or an OpenVEX statement (kind vex). Absent when it counts.",
      "type": "object",
      "additionalProperties": false,
      "required": ["kind", "reason"],
      "properties": {
        "kind": { "enum": ["ignore", "vex"] },
        "reason": { "description": "The ignore entry's reason, or the statement's impact_statement, else its justification.", "type": "string", "minLength": 1 },
        "until": { "description": "The ignore entry's last day.", "type": "string", "format": "date" },
        "source": { "description": "The VEX document's path.", "type": "string", "minLength": 1 },
        "status": { "description": "The VEX status.", "enum": ["not_affected", "fixed"] },
        "justification": { "description": "The VEX justification label.", "type": "string", "minLength": 1 }
      }
    },
    "binary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["tool", "path", "go_version", "queries", "vulns"],
      "properties": {
        "tool": { "type": "string", "minLength": 1 },
        "path": { "type": "string", "minLength": 1 },
        "go_version": { "type": "string", "minLength": 1 },
        "module": { "type": "string", "minLength": 1 },
        "module_version": { "description": "Absent for (devel) builds.", "type": "string", "minLength": 1 },
        "module_unchecked": { "description": "Why OSV wasn't asked about the main module: private-source when its tool may be private or GOPRIVATE names it.", "enum": ["private-source", "offline", "failed"] },
        "queries": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["package", "version"],
            "properties": {
              "package": { "$ref": "#/$defs/osvPackage" },
              "version": { "type": "string", "minLength": 1 }
            }
          }
        },
        "vulns": { "type": "array", "items": { "$ref": "#/$defs/vuln" } }
      }
    }
  }
}
