{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lazaretto-dev/json-schema/lazaretto-dev-scan-report-schema.json",
  "title": "ScanReport",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lazaretto-dev-openapi.yml#/components/schemas/ScanReport",
  "type": "object",
  "properties": {
    "scan_id": {
      "type": "string"
    },
    "target_hash": {
      "type": "string",
      "pattern": "^(sha256:[0-9a-f]{64})?$",
      "description": "Hash of exactly what was analyzed. EMPTY STRING when no bytes were read: an npm package that was taken down from the registry is still reported malicious on package IDENTITY, and there is no content to bind that claim to. Check for the empty string before using this in a /report/ or badge URL."
    },
    "verdict": {
      "type": "string",
      "enum": [
        "clear",
        "flagged",
        "malicious",
        "error"
      ]
    },
    "confidence": {
      "type": "string",
      "enum": [
        "high",
        "medium",
        "low"
      ]
    },
    "risk": {
      "type": "string",
      "enum": [
        "critical",
        "high",
        "medium",
        "low",
        "none",
        "unknown"
      ],
      "description": "How serious the concern is, and the field to gate on. `verdict` only says whether anything fired, so a credential stealer and a bundler that uses Function() are both `flagged`. `risk` separates them: reading secrets AND being able to ship them is critical; constructing code at run time is medium. `unknown` appears only with `verdict` \"error\" (HTTP 422): the scan did not finish, so no level is asserted. It is not a clear result, and a client should treat it, and any value it does not recognize, as a reason to stop and ask."
    },
    "risk_summary": {
      "type": "string",
      "description": "One plain sentence naming the concern."
    },
    "known_bad": {
      "$ref": "#/$defs/KnownBad"
    },
    "findings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Finding"
      }
    },
    "tool_fingerprint": {
      "type": "object",
      "description": "Only for mcp_server and mcp_tools targets. Hashes of what the server tells an agent: `tools` maps each tool name to a SHA-256 and `sha256` covers all of them plus the server instructions. Keep `sha256` when you approve a server and compare it on a later scan: a server can change its tools after review. `partial` means a cap cut the read.",
      "properties": {
        "sha256": {
          "type": "string"
        },
        "tools": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "instructions": {
          "type": "string"
        },
        "partial": {
          "type": "boolean"
        }
      }
    },
    "rules_version": {
      "type": "string"
    },
    "scanned_at": {
      "type": "string",
      "format": "date-time"
    },
    "disclaimer": {
      "type": "string"
    },
    "attestation": {
      "type": "string",
      "description": "Compact JWS (EdDSA) over the verdict core, present on a full scan that did not end in an error. Verify it against /.well-known/jwks.json (offline) or POST /v1/verify. Its `sub` claim binds it to this artifact, so an agent can share the verdict and any recipient can trust it without re-scanning. Left out when an x402 payment did not settle or its outcome is unknown (see `payment`)."
    },
    "payment": {
      "type": "object",
      "description": "x402 only, present only when the payment facilitator did not answer clearly, so whether the payment settled is unknown. Do not pay again for this scan.",
      "properties": {
        "outcome": {
          "type": "string",
          "enum": [
            "unknown"
          ]
        },
        "detail": {
          "type": "string"
        },
        "contact": {
          "type": "string"
        },
        "time": {
          "type": "string",
          "format": "date-time",
          "description": "Quote this with the paying wallet address when writing in."
        }
      }
    }
  },
  "$defs": {
    "Finding": {
      "type": "object",
      "properties": {
        "rule_id": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "severity": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low",
            "info"
          ]
        },
        "description": {
          "type": "string"
        },
        "evidence": {
          "type": "object",
          "properties": {
            "file": {
              "type": "string"
            },
            "line": {
              "type": "integer"
            },
            "snippet": {
              "type": "string"
            }
          }
        }
      }
    },
    "KnownBad": {
      "type": "object",
      "properties": {
        "matched": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "true=known-bad; false=checked clean; null=could not check (fail-closed)."
        },
        "match_type": {
          "type": "string",
          "enum": [
            "exact_hash",
            "fuzzy_hash",
            "embedded_ioc",
            "known_publisher",
            "malicious_package"
          ],
          "description": "How the known-bad match was made. `malicious_package` means the package identity (name + version) is listed as malware in the OSV/OpenSSF corpus, which is scoped to the affected versions: a project compromised in one release is not condemned in its later clean ones."
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}