{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://grokify.github.io/threat-model-spec/versions/v0.9.0/diagram.schema.json",
  "$ref": "#/$defs/DiagramIR",
  "$defs": {
    "Actor": {
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/ElementType"
        },
        "malicious": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "label"
      ]
    },
    "AgentCapabilities": {
      "properties": {
        "tools": {
          "items": {
            "$ref": "#/$defs/AgentTool"
          },
          "type": "array"
        },
        "permissions": {
          "items": {
            "$ref": "#/$defs/AgentPermission"
          },
          "type": "array"
        },
        "sandboxLevel": {
          "$ref": "#/$defs/AgentSandboxLevel"
        },
        "requiresApproval": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "approvalBypassable": {
          "type": "boolean"
        },
        "maxExecutionTime": {
          "type": "string"
        },
        "resourceLimits": {
          "$ref": "#/$defs/AgentResourceLimits"
        },
        "networkRestrictions": {
          "$ref": "#/$defs/AgentNetworkRestrictions"
        },
        "integratedServices": {
          "items": {
            "$ref": "#/$defs/AgentIntegration"
          },
          "type": "array"
        },
        "escalationPaths": {
          "items": {
            "$ref": "#/$defs/AgentEscalationPath"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "AgentCapabilityType": {
      "type": "string",
      "enum": [
        "code-execution",
        "file-access",
        "network-access",
        "shell-access",
        "database-access",
        "api-access",
        "browser-control",
        "messaging",
        "memory-access",
        "tool-invocation"
      ]
    },
    "AgentEscalationPath": {
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "sourceCapability": {
          "$ref": "#/$defs/AgentCapabilityType"
        },
        "targetCapability": {
          "$ref": "#/$defs/AgentCapabilityType"
        },
        "mechanism": {
          "type": "string"
        },
        "mitigations": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "asiIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "sourceCapability",
        "targetCapability"
      ]
    },
    "AgentIntegration": {
      "properties": {
        "service": {
          "type": "string"
        },
        "permissions": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "credentialId": {
          "type": "string"
        },
        "scopes": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "service"
      ]
    },
    "AgentNetworkRestrictions": {
      "properties": {
        "allowedHosts": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "blockedHosts": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "allowedPorts": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "internetAccess": {
          "type": "boolean"
        },
        "localhostAccess": {
          "type": "boolean"
        },
        "internalNetworkAccess": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "AgentPermission": {
      "properties": {
        "resource": {
          "type": "string"
        },
        "actions": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "scope": {
          "type": "string"
        },
        "conditions": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "resource"
      ]
    },
    "AgentResourceLimits": {
      "properties": {
        "maxMemoryMb": {
          "type": "integer"
        },
        "maxCpuPercent": {
          "type": "integer"
        },
        "maxDiskMb": {
          "type": "integer"
        },
        "maxOpenFiles": {
          "type": "integer"
        },
        "maxProcesses": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "AgentSandboxLevel": {
      "type": "string",
      "enum": [
        "none",
        "process",
        "container",
        "vm",
        "remote"
      ]
    },
    "AgentTool": {
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "capabilityType": {
          "$ref": "#/$defs/AgentCapabilityType"
        },
        "enabled": {
          "type": "boolean"
        },
        "requiresApproval": {
          "type": "boolean"
        },
        "riskLevel": {
          "$ref": "#/$defs/RiskLevel"
        },
        "parameters": {
          "items": {
            "$ref": "#/$defs/AgentToolParameter"
          },
          "type": "array"
        },
        "asiIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "capabilityType"
      ]
    },
    "AgentToolParameter": {
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "validation": {
          "type": "string"
        },
        "sensitiveData": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name"
      ]
    },
    "AlignmentFailureMode": {
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "primary": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id"
      ]
    },
    "AssetClassification": {
      "type": "string",
      "enum": [
        "crown-jewel",
        "high",
        "medium",
        "low"
      ]
    },
    "Attack": {
      "properties": {
        "step": {
          "type": "integer"
        },
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "action": {
          "type": "string"
        },
        "outcome": {
          "type": "string"
        },
        "mitreTactic": {
          "$ref": "#/$defs/MITRETactic"
        },
        "mitreTechnique": {
          "type": "string"
        },
        "atlasTechnique": {
          "type": "string"
        },
        "owaspIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "asiIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "strideThreats": {
          "items": {
            "$ref": "#/$defs/STRIDEThreat"
          },
          "type": "array"
        },
        "linddunThreats": {
          "items": {
            "$ref": "#/$defs/LINDDUNThreat"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "redTeamNotes": {
          "type": "string"
        },
        "blueTeamNotes": {
          "type": "string"
        },
        "remediationNote": {
          "type": "string"
        },
        "testRef": {
          "$ref": "#/$defs/TestReference"
        },
        "componentRefs": {
          "items": {
            "$ref": "#/$defs/ComponentReference"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "step",
        "from",
        "to",
        "label"
      ]
    },
    "AttackTree": {
      "properties": {
        "rootId": {
          "type": "string"
        },
        "nodes": {
          "items": {
            "$ref": "#/$defs/AttackTreeNode"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "rootId",
        "nodes"
      ]
    },
    "AttackTreeNode": {
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "nodeType": {
          "$ref": "#/$defs/AttackTreeNodeType"
        },
        "description": {
          "type": "string"
        },
        "children": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "mitreTechnique": {
          "type": "string"
        },
        "strideThreats": {
          "items": {
            "$ref": "#/$defs/STRIDEThreat"
          },
          "type": "array"
        },
        "probability": {
          "type": "number"
        },
        "cost": {
          "type": "string"
        },
        "difficulty": {
          "type": "string"
        },
        "countermeasure": {
          "type": "string"
        },
        "mitigated": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "label",
        "nodeType"
      ]
    },
    "AttackTreeNodeType": {
      "type": "string",
      "enum": [
        "AND",
        "OR",
        "LEAF"
      ]
    },
    "Boundary": {
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/BoundaryType"
        },
        "parentId": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "implicitlyTrusted": {
          "type": "boolean"
        },
        "trustAssumption": {
          "type": "string"
        },
        "trustViolationRisk": {
          "type": "string"
        },
        "breachVector": {
          "type": "string"
        },
        "authenticationRequired": {
          "type": "boolean"
        },
        "authorizationEnforced": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "label",
        "type"
      ]
    },
    "BoundaryType": {
      "type": "string",
      "enum": [
        "browser",
        "localhost",
        "network",
        "cloud",
        "breached",
        "container",
        "sandbox",
        "agent",
        "origin"
      ]
    },
    "BrowserExecutionInfo": {
      "properties": {
        "origin": {
          "type": "string"
        },
        "sameSite": {
          "type": "string"
        },
        "crossOriginIsolated": {
          "type": "boolean"
        },
        "serviceWorker": {
          "type": "boolean"
        },
        "webWorker": {
          "type": "boolean"
        },
        "localStorageAccess": {
          "type": "boolean"
        },
        "cookieAccess": {
          "type": "boolean"
        },
        "localhostAccess": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "CISControlMapping": {
      "properties": {
        "controlId": {
          "type": "string"
        },
        "controlName": {
          "type": "string"
        },
        "safeguardId": {
          "type": "string"
        },
        "safeguardName": {
          "type": "string"
        },
        "implementationGroup": {
          "type": "string"
        },
        "assetType": {
          "type": "string"
        },
        "securityFunction": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "controlId"
      ]
    },
    "CVEMapping": {
      "properties": {
        "id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "affectedComponents": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "affectedVersions": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "cvss": {
          "$ref": "#/$defs/CVSSMapping"
        },
        "url": {
          "type": "string"
        },
        "references": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id"
      ]
    },
    "CVSSMapping": {
      "properties": {
        "version": {
          "type": "string"
        },
        "vector": {
          "type": "string"
        },
        "baseScore": {
          "type": "number"
        },
        "severity": {
          "$ref": "#/$defs/CVSSSeverity"
        },
        "description": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "version",
        "vector",
        "baseScore",
        "severity"
      ]
    },
    "CVSSSeverity": {
      "type": "string",
      "enum": [
        "None",
        "Low",
        "Medium",
        "High",
        "Critical"
      ]
    },
    "CWEMapping": {
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id"
      ]
    },
    "CloudInfo": {
      "properties": {
        "provider": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "vpc": {
          "type": "string"
        },
        "subnet": {
          "type": "string"
        },
        "resourceId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "ComplianceFramework": {
      "type": "string",
      "enum": [
        "soc2",
        "pci-dss",
        "hipaa",
        "gdpr",
        "ccpa",
        "fedramp",
        "nist-sp-800-53",
        "nist-sp-800-171",
        "sox",
        "glba"
      ]
    },
    "ComplianceMapping": {
      "properties": {
        "framework": {
          "$ref": "#/$defs/ComplianceFramework"
        },
        "requirementId": {
          "type": "string"
        },
        "requirementName": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "evidence": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "framework",
        "requirementId"
      ]
    },
    "ComponentReference": {
      "properties": {
        "id": {
          "type": "string"
        },
        "purl": {
          "type": "string"
        },
        "cpe": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "supplier": {
          "type": "string"
        },
        "license": {
          "type": "string"
        },
        "vulnerabilityIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "ContainerExecutionInfo": {
      "properties": {
        "runtime": {
          "type": "string"
        },
        "image": {
          "type": "string"
        },
        "privileged": {
          "type": "boolean"
        },
        "hostPid": {
          "type": "boolean"
        },
        "hostNetwork": {
          "type": "boolean"
        },
        "volumes": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "readOnlyRootFs": {
          "type": "boolean"
        },
        "dropCapabilities": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "Controls": {
      "properties": {
        "nistCsf": {
          "items": {
            "$ref": "#/$defs/NISTCSFMapping"
          },
          "type": "array"
        },
        "cis": {
          "items": {
            "$ref": "#/$defs/CISControlMapping"
          },
          "type": "array"
        },
        "iso27001": {
          "items": {
            "$ref": "#/$defs/ISO27001Mapping"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "DataSourceType": {
      "type": "string",
      "enum": [
        "logs",
        "siem",
        "edr",
        "ndr",
        "ids",
        "waf",
        "cloudtrail",
        "api-gateway",
        "network-capture",
        "user-behavior",
        "audit-log"
      ]
    },
    "Detection": {
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "threatIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "attackSteps": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "mitreTechniques": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "method": {
          "type": "string"
        },
        "dataSources": {
          "items": {
            "$ref": "#/$defs/DataSourceType"
          },
          "type": "array"
        },
        "coverage": {
          "$ref": "#/$defs/DetectionCoverage"
        },
        "latencySeconds": {
          "type": "integer"
        },
        "falsePositiveRate": {
          "type": "string"
        },
        "detectionLogic": {
          "type": "string"
        },
        "tool": {
          "type": "string"
        },
        "playbookId": {
          "type": "string"
        },
        "alertSeverity": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "title",
        "coverage"
      ]
    },
    "DetectionCoverage": {
      "type": "string",
      "enum": [
        "none",
        "partial",
        "full"
      ]
    },
    "DiagramIR": {
      "properties": {
        "type": {
          "$ref": "#/$defs/DiagramType"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "direction": {
          "$ref": "#/$defs/Direction"
        },
        "legend": {
          "$ref": "#/$defs/Legend"
        },
        "mappings": {
          "$ref": "#/$defs/Mappings"
        },
        "elements": {
          "items": {
            "$ref": "#/$defs/Element"
          },
          "type": "array"
        },
        "boundaries": {
          "items": {
            "$ref": "#/$defs/Boundary"
          },
          "type": "array"
        },
        "flows": {
          "items": {
            "$ref": "#/$defs/Flow"
          },
          "type": "array"
        },
        "attacks": {
          "items": {
            "$ref": "#/$defs/Attack"
          },
          "type": "array"
        },
        "targets": {
          "items": {
            "$ref": "#/$defs/Target"
          },
          "type": "array"
        },
        "actors": {
          "items": {
            "$ref": "#/$defs/Actor"
          },
          "type": "array"
        },
        "phases": {
          "items": {
            "$ref": "#/$defs/Phase"
          },
          "type": "array"
        },
        "messages": {
          "items": {
            "$ref": "#/$defs/Message"
          },
          "type": "array"
        },
        "attackTree": {
          "$ref": "#/$defs/AttackTree"
        },
        "threats": {
          "items": {
            "$ref": "#/$defs/ThreatEntry"
          },
          "type": "array"
        },
        "mitigations": {
          "items": {
            "$ref": "#/$defs/Mitigation"
          },
          "type": "array"
        },
        "showMitigations": {
          "type": "boolean"
        },
        "detections": {
          "items": {
            "$ref": "#/$defs/Detection"
          },
          "type": "array"
        },
        "responseActions": {
          "items": {
            "$ref": "#/$defs/ResponseAction"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "type",
        "title"
      ]
    },
    "DiagramType": {
      "type": "string",
      "enum": [
        "dfd",
        "attack-chain",
        "sequence",
        "attack-tree"
      ]
    },
    "Direction": {
      "type": "string",
      "enum": [
        "right",
        "down",
        "left",
        "up"
      ]
    },
    "Element": {
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/ElementType"
        },
        "parentId": {
          "type": "string"
        },
        "classification": {
          "$ref": "#/$defs/AssetClassification"
        },
        "strideThreats": {
          "items": {
            "$ref": "#/$defs/STRIDEThreat"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "network": {
          "$ref": "#/$defs/NetworkInfo"
        },
        "assetIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "agentCapabilities": {
          "$ref": "#/$defs/AgentCapabilities"
        },
        "executionContext": {
          "$ref": "#/$defs/ExecutionContext"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "label",
        "type"
      ]
    },
    "ElementType": {
      "type": "string",
      "enum": [
        "process",
        "datastore",
        "external-entity",
        "gateway",
        "browser",
        "agent",
        "api"
      ]
    },
    "EscapeVector": {
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "sourceContext": {
          "$ref": "#/$defs/ExecutionEnvironmentType"
        },
        "targetContext": {
          "$ref": "#/$defs/ExecutionEnvironmentType"
        },
        "targetPrivilegeLevel": {
          "$ref": "#/$defs/ExecutionPrivilegeLevel"
        },
        "mechanism": {
          "type": "string"
        },
        "prerequisites": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "cweIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "mitreTechnique": {
          "type": "string"
        },
        "mitigations": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "sourceContext",
        "targetContext"
      ]
    },
    "ExecutionContext": {
      "properties": {
        "environmentType": {
          "$ref": "#/$defs/ExecutionEnvironmentType"
        },
        "privilegeLevel": {
          "$ref": "#/$defs/ExecutionPrivilegeLevel"
        },
        "user": {
          "type": "string"
        },
        "groups": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "processName": {
          "type": "string"
        },
        "workingDirectory": {
          "type": "string"
        },
        "environmentVariables": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "capabilities": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "selinuxContext": {
          "type": "string"
        },
        "appArmorProfile": {
          "type": "string"
        },
        "seccompProfile": {
          "type": "string"
        },
        "containerInfo": {
          "$ref": "#/$defs/ContainerExecutionInfo"
        },
        "browserInfo": {
          "$ref": "#/$defs/BrowserExecutionInfo"
        },
        "networkAccess": {
          "$ref": "#/$defs/ExecutionNetworkAccess"
        },
        "filesystemAccess": {
          "$ref": "#/$defs/ExecutionFilesystemAccess"
        },
        "escapeVectors": {
          "items": {
            "$ref": "#/$defs/EscapeVector"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "environmentType",
        "privilegeLevel"
      ]
    },
    "ExecutionEnvironmentType": {
      "type": "string",
      "enum": [
        "host",
        "container",
        "vm",
        "browser",
        "serverless",
        "sandbox"
      ]
    },
    "ExecutionFilesystemAccess": {
      "properties": {
        "readPaths": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "writePaths": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "executePaths": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "mountPoints": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "tempDirectory": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "ExecutionNetworkAccess": {
      "properties": {
        "canAccessInternet": {
          "type": "boolean"
        },
        "canAccessLocalhost": {
          "type": "boolean"
        },
        "canAccessInternalNetwork": {
          "type": "boolean"
        },
        "allowedPorts": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "blockedPorts": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "dnsAccess": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "ExecutionPrivilegeLevel": {
      "type": "string",
      "enum": [
        "root",
        "admin",
        "user",
        "service",
        "restricted",
        "none"
      ]
    },
    "Flow": {
      "properties": {
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/FlowType"
        },
        "bidirectional": {
          "type": "boolean"
        },
        "protocol": {
          "type": "string"
        },
        "encrypted": {
          "type": "boolean"
        },
        "authenticated": {
          "type": "boolean"
        },
        "crossOrigin": {
          "type": "boolean"
        },
        "credentialFlowId": {
          "type": "string"
        },
        "dataClassification": {
          "$ref": "#/$defs/AssetClassification"
        },
        "cweIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "from",
        "to"
      ]
    },
    "FlowType": {
      "type": "string",
      "enum": [
        "normal",
        "attack",
        "exfil",
        "credential",
        "websocket",
        "cswsh",
        "lateral",
        "coordination"
      ]
    },
    "ISO27001Mapping": {
      "properties": {
        "controlId": {
          "type": "string"
        },
        "controlName": {
          "type": "string"
        },
        "domain": {
          "type": "string"
        },
        "objective": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "controlId"
      ]
    },
    "LINDDUNMapping": {
      "properties": {
        "category": {
          "$ref": "#/$defs/LINDDUNThreat"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "affectedDataTypes": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "affectedComponents": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "dataSubjects": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "privacyPrinciple": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "category"
      ]
    },
    "LINDDUNThreat": {
      "type": "string",
      "enum": [
        "L",
        "I",
        "N",
        "D",
        "Di",
        "U",
        "Nc"
      ]
    },
    "Legend": {
      "properties": {
        "show": {
          "type": "boolean"
        },
        "showStride": {
          "type": "boolean"
        },
        "showLinddun": {
          "type": "boolean"
        },
        "showMitre": {
          "type": "boolean"
        },
        "showAssets": {
          "type": "boolean"
        },
        "showElements": {
          "type": "boolean"
        },
        "showBoundaries": {
          "type": "boolean"
        },
        "showMitigations": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "show"
      ]
    },
    "MITREATLASMapping": {
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id"
      ]
    },
    "MITREAttackMapping": {
      "properties": {
        "tacticId": {
          "type": "string"
        },
        "tacticName": {
          "type": "string"
        },
        "techniqueId": {
          "type": "string"
        },
        "techniqueName": {
          "type": "string"
        },
        "subTechniqueId": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "tacticId",
        "techniqueId"
      ]
    },
    "MITRETactic": {
      "type": "string",
      "enum": [
        "TA0001",
        "TA0002",
        "TA0003",
        "TA0004",
        "TA0005",
        "TA0006",
        "TA0007",
        "TA0008",
        "TA0009",
        "TA0010",
        "TA0011",
        "TA0040"
      ]
    },
    "Mappings": {
      "properties": {
        "mitreAttack": {
          "items": {
            "$ref": "#/$defs/MITREAttackMapping"
          },
          "type": "array"
        },
        "mitreAtlas": {
          "items": {
            "$ref": "#/$defs/MITREATLASMapping"
          },
          "type": "array"
        },
        "alignmentFailureModes": {
          "items": {
            "$ref": "#/$defs/AlignmentFailureMode"
          },
          "type": "array"
        },
        "owasp": {
          "items": {
            "$ref": "#/$defs/OWASPMapping"
          },
          "type": "array"
        },
        "cwe": {
          "items": {
            "$ref": "#/$defs/CWEMapping"
          },
          "type": "array"
        },
        "cve": {
          "items": {
            "$ref": "#/$defs/CVEMapping"
          },
          "type": "array"
        },
        "cvss": {
          "$ref": "#/$defs/CVSSMapping"
        },
        "stride": {
          "items": {
            "$ref": "#/$defs/STRIDEMapping"
          },
          "type": "array"
        },
        "linddun": {
          "items": {
            "$ref": "#/$defs/LINDDUNMapping"
          },
          "type": "array"
        },
        "controls": {
          "$ref": "#/$defs/Controls"
        },
        "compliance": {
          "items": {
            "$ref": "#/$defs/ComplianceMapping"
          },
          "type": "array"
        },
        "summaries": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "Message": {
      "properties": {
        "seq": {
          "type": "integer"
        },
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/FlowType"
        },
        "mitreTechnique": {
          "type": "string"
        },
        "note": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "seq",
        "from",
        "to",
        "label"
      ]
    },
    "Mitigation": {
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "threatIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "strideCategories": {
          "items": {
            "$ref": "#/$defs/STRIDEThreat"
          },
          "type": "array"
        },
        "controlId": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/MitigationStatus"
        },
        "owner": {
          "type": "string"
        },
        "verifiedDate": {
          "type": "string"
        },
        "effectiveness": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        },
        "producerRunId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "title",
        "status"
      ]
    },
    "MitigationStatus": {
      "type": "string",
      "enum": [
        "planned",
        "implemented",
        "partial",
        "accepted",
        "transferred",
        "not-applicable"
      ]
    },
    "NISTCSFFunction": {
      "type": "string",
      "enum": [
        "Identify",
        "Protect",
        "Detect",
        "Respond",
        "Recover"
      ]
    },
    "NISTCSFMapping": {
      "properties": {
        "function": {
          "$ref": "#/$defs/NISTCSFFunction"
        },
        "category": {
          "type": "string"
        },
        "categoryName": {
          "type": "string"
        },
        "subcategory": {
          "type": "string"
        },
        "subcategoryName": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "function",
        "category"
      ]
    },
    "NetworkInfo": {
      "properties": {
        "host": {
          "type": "string"
        },
        "ports": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "protocols": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "zone": {
          "type": "string"
        },
        "cidr": {
          "type": "string"
        },
        "cloud": {
          "$ref": "#/$defs/CloudInfo"
        },
        "webSocket": {
          "$ref": "#/$defs/WebSocketConfig"
        },
        "allowedOrigins": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "originValidation": {
          "type": "boolean"
        },
        "rateLimitRps": {
          "type": "integer"
        },
        "rateLimitConnections": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "OWASPCategory": {
      "type": "string",
      "enum": [
        "api",
        "llm",
        "web",
        "agentic"
      ]
    },
    "OWASPMapping": {
      "properties": {
        "category": {
          "$ref": "#/$defs/OWASPCategory"
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "category",
        "id"
      ]
    },
    "Phase": {
      "properties": {
        "name": {
          "type": "string"
        },
        "mitreTactic": {
          "$ref": "#/$defs/MITRETactic"
        },
        "description": {
          "type": "string"
        },
        "startMessage": {
          "type": "integer"
        },
        "endMessage": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "startMessage",
        "endMessage"
      ]
    },
    "ResponseAction": {
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "triggerDetectionIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "actionType": {
          "type": "string"
        },
        "automated": {
          "type": "boolean"
        },
        "playbookUrl": {
          "type": "string"
        },
        "owner": {
          "type": "string"
        },
        "escalationPath": {
          "type": "string"
        },
        "slaMinutes": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "title"
      ]
    },
    "RiskAssessment": {
      "properties": {
        "likelihood": {
          "type": "integer"
        },
        "impact": {
          "type": "integer"
        },
        "score": {
          "type": "integer"
        },
        "level": {
          "$ref": "#/$defs/RiskLevel"
        },
        "likelihoodRationale": {
          "type": "string"
        },
        "impactRationale": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "likelihood",
        "impact"
      ]
    },
    "RiskLevel": {
      "type": "string",
      "enum": [
        "critical",
        "high",
        "medium",
        "low",
        "info"
      ]
    },
    "SSVCAssessment": {
      "properties": {
        "vulnerabilityId": {
          "type": "string"
        },
        "exploitation": {
          "type": "string"
        },
        "automatable": {
          "type": "string"
        },
        "technicalImpact": {
          "type": "string"
        },
        "missionPrevalence": {
          "type": "string"
        },
        "publicWellBeing": {
          "type": "string"
        },
        "decision": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        },
        "assessedAt": {
          "type": "string"
        },
        "assessedBy": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "STRIDEMapping": {
      "properties": {
        "category": {
          "$ref": "#/$defs/STRIDEThreat"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "affectedComponents": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "category"
      ]
    },
    "STRIDEThreat": {
      "type": "string",
      "enum": [
        "S",
        "T",
        "R",
        "I",
        "D",
        "E"
      ]
    },
    "Target": {
      "properties": {
        "elementId": {
          "type": "string"
        },
        "classification": {
          "$ref": "#/$defs/AssetClassification"
        },
        "strideThreats": {
          "items": {
            "$ref": "#/$defs/STRIDEThreat"
          },
          "type": "array"
        },
        "impact": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "elementId",
        "classification"
      ]
    },
    "TestPurpose": {
      "type": "string",
      "enum": [
        "exploitation",
        "detection",
        "remediation",
        "regression"
      ]
    },
    "TestReference": {
      "properties": {
        "testId": {
          "type": "string"
        },
        "testFile": {
          "type": "string"
        },
        "purpose": {
          "$ref": "#/$defs/TestPurpose"
        },
        "description": {
          "type": "string"
        },
        "suiteId": {
          "type": "string"
        },
        "attackStep": {
          "type": "integer"
        },
        "automated": {
          "type": "boolean"
        },
        "tool": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "testId",
        "purpose"
      ]
    },
    "ThreatEntry": {
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "strideCategory": {
          "$ref": "#/$defs/STRIDEThreat"
        },
        "linddunCategory": {
          "$ref": "#/$defs/LINDDUNThreat"
        },
        "affectedElements": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "affectedAssets": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "status": {
          "$ref": "#/$defs/ThreatStatus"
        },
        "risk": {
          "$ref": "#/$defs/RiskAssessment"
        },
        "severity": {
          "type": "string"
        },
        "likelihood": {
          "type": "string"
        },
        "mitigationIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "attackVector": {
          "type": "string"
        },
        "preconditions": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "ssvcAssessment": {
          "$ref": "#/$defs/SSVCAssessment"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "title",
        "status"
      ]
    },
    "ThreatStatus": {
      "type": "string",
      "enum": [
        "potential",
        "theoretical",
        "identified",
        "analyzing",
        "mitigated",
        "accepted",
        "transferred",
        "monitoring"
      ]
    },
    "WebSocketConfig": {
      "properties": {
        "protocol": {
          "$ref": "#/$defs/WebSocketProtocol"
        },
        "endpoint": {
          "type": "string"
        },
        "allowedOrigins": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "originValidation": {
          "type": "boolean"
        },
        "csrfProtection": {
          "type": "boolean"
        },
        "authenticationRequired": {
          "type": "boolean"
        },
        "authenticationMethod": {
          "type": "string"
        },
        "rateLimitRps": {
          "type": "integer"
        },
        "rateLimitConnections": {
          "type": "integer"
        },
        "messageSizeLimit": {
          "type": "integer"
        },
        "subProtocols": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "vulnerabilities": {
          "items": {
            "$ref": "#/$defs/WebSocketVulnerability"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "WebSocketProtocol": {
      "type": "string",
      "enum": [
        "ws",
        "wss"
      ]
    },
    "WebSocketVulnType": {
      "type": "string",
      "enum": [
        "cswsh",
        "no-origin-validation",
        "no-rate-limit",
        "no-authentication",
        "weak-authentication",
        "no-encryption",
        "message-injection",
        "denial-of-service"
      ]
    },
    "WebSocketVulnerability": {
      "properties": {
        "type": {
          "$ref": "#/$defs/WebSocketVulnType"
        },
        "description": {
          "type": "string"
        },
        "cweIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "severity": {
          "type": "string"
        },
        "exploitable": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "type"
      ]
    }
  }
}