{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sonny.sh/schemas/isolation-docker-image-statement-v2.json",
  "title": "Sonny Docker isolation image statement",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "version", "key_id", "reference", "manifest_digest", "config_digest",
    "rootfs_digest", "os", "architecture", "unpacked_bytes",
    "highest_vulnerability", "signature_digest", "provenance_digest",
    "sbom_digest", "vulnerability_digest", "revocation_epoch",
    "verified_at_unix_milli", "expires_at_unix_milli", "local",
    "runtime_facts"
  ],
  "properties": {
    "version": {"const": 2},
    "key_id": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\s].*[^\\s]$|^[^\\s]$"},
    "reference": {"type": "string", "minLength": 73, "maxLength": 4096, "pattern": "@sha256:[a-f0-9]{64}$"},
    "manifest_digest": {"$ref": "#/$defs/ociDigest"},
    "config_digest": {"$ref": "#/$defs/ociDigest"},
    "rootfs_digest": {"$ref": "#/$defs/digest"},
    "os": {"type": "string", "minLength": 1, "maxLength": 64},
    "architecture": {"type": "string", "minLength": 1, "maxLength": 64},
    "unpacked_bytes": {"type": "integer", "minimum": 1},
    "highest_vulnerability": {"enum": ["none", "low", "medium", "high", "critical"]},
    "signature_digest": {"$ref": "#/$defs/digest"},
    "provenance_digest": {"$ref": "#/$defs/digest"},
    "sbom_digest": {"$ref": "#/$defs/digest"},
    "vulnerability_digest": {"$ref": "#/$defs/digest"},
    "revocation_epoch": {"type": "integer", "minimum": 1},
    "verified_at_unix_milli": {"type": "integer", "minimum": 1},
    "expires_at_unix_milli": {"type": "integer", "minimum": 1},
    "local": {"type": "boolean"},
    "runtime_facts": {"$ref": "#/$defs/runtimeFacts"}
  },
  "$defs": {
    "digest": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
    "ociDigest": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"},
    "runtimeFacts": {
      "type": "object",
      "additionalProperties": false,
      "required": ["os", "arch", "executables"],
      "properties": {
        "os": {"type": "string", "minLength": 1, "maxLength": 64},
        "arch": {"type": "string", "minLength": 1, "maxLength": 64},
        "executables": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 256,
          "propertyNames": {"minLength": 1, "maxLength": 256},
          "additionalProperties": {"type": "string", "pattern": "^/[^\\u0000]*$", "maxLength": 4096}
        }
      }
    }
  }
}
