UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

44 lines (42 loc) 1.32 kB
// src/schemas/common/property-schemas/attack-platforms.ts import { z } from "zod"; var supportedMitrePlatforms = [ "Field Controller/RTU/PLC/IED", "Network Devices", "Data Historian", "Google Workspace", "Office Suite", "ESXi", "Identity Provider", "Containers", "Azure AD", "Engineering Workstation", "Control Server", "Human-Machine Interface", "Windows", "Linux", "IaaS", "None", "iOS", "PRE", "SaaS", "Input/Output Server", "macOS", "Android", "Safety Instrumented System/Protection Relay", "Embedded" ]; var xMitrePlatformSchema = z.enum(supportedMitrePlatforms, { error: () => `Platform must be one of: ${supportedMitrePlatforms.join(", ")}` }).meta({ description: "A technology environments and/or operating system that ATT&CK techniques are applicable within." }); var xMitrePlatformsSchema = z.array(xMitrePlatformSchema, { error: (issue) => issue.code === "invalid_type" ? "x_mitre_platforms must be an array of strings" : "Invalid platforms array" }).min(1, "At least one platform is required").refine((items) => new Set(items).size === items.length, { message: "Platforms must be unique (no duplicates allowed)." }).meta({ description: "List of platforms that apply to the object." }); export { xMitrePlatformSchema, xMitrePlatformsSchema };