{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hogarmas.net/prompt-firewall/schema.json",
  "title": "H/M Prompt Firewall export packet",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "ruleset", "generatedAt", "input", "analysis", "limitations"],
  "properties": {
    "schema": { "const": "hm.prompt-firewall.v1" },
    "ruleset": { "type": "string" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "input": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sha256", "length", "lineCount", "sample", "rawTextIncluded", "redactedTextIncluded"],
      "properties": {
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "length": { "type": "integer", "minimum": 1, "maximum": 30000 },
        "lineCount": { "type": "integer", "minimum": 1 },
        "sample": { "type": "boolean" },
        "rawTextIncluded": { "const": false },
        "redactedTextIncluded": { "const": false }
      }
    },
    "analysis": {
      "type": "object",
      "required": ["mode", "summary", "findings"],
      "properties": {
        "mode": { "enum": ["untrusted", "outbound"] },
        "summary": { "type": "object" },
        "findings": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["id", "type", "category", "severity", "line", "column", "length", "evidence", "recommendation"],
            "properties": {
              "id": { "type": "string" },
              "type": { "type": "string" },
              "category": { "type": "string" },
              "severity": { "enum": ["critical", "high", "medium", "low"] },
              "line": { "type": "integer", "minimum": 1 },
              "column": { "type": "integer", "minimum": 1 },
              "length": { "type": "integer", "minimum": 1 },
              "evidence": { "type": "string" },
              "recommendation": { "type": "string" }
            }
          }
        }
      }
    },
    "limitations": {
      "type": "object",
      "additionalProperties": false,
      "required": ["securityVerdictProduced", "novelSemanticInjectionGuaranteedDetected", "multimodalContentAnalyzed", "textUploadedByAnalyzer", "deterministicHeuristics", "requiresDefenseInDepth", "redactionNeutralizesInjection"],
      "properties": {
        "securityVerdictProduced": { "const": false },
        "novelSemanticInjectionGuaranteedDetected": { "const": false },
        "multimodalContentAnalyzed": { "const": false },
        "textUploadedByAnalyzer": { "const": false },
        "deterministicHeuristics": { "const": true },
        "requiresDefenseInDepth": { "const": true },
        "redactionNeutralizesInjection": { "const": false }
      }
    }
  }
}
