UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

73 lines (69 loc) 2.59 kB
import { attackBaseDomainObjectSchema } from "./chunk-ZHQVMLOZ.js"; import { descriptionSchema } from "./chunk-DNIVZ2SM.js"; import { createAttackExternalReferencesSchema } from "./chunk-UP3ZMB5U.js"; import { xMitreContributorsSchema, xMitreModifiedByRefSchema } from "./chunk-U55YRJAX.js"; import { createStixIdValidator } from "./chunk-E3OY6DRE.js"; import { createStixTypeValidator } from "./chunk-PFSYT437.js"; import { xMitreDomainsSchema } from "./chunk-ZEHAFUHO.js"; import { xMitrePlatformsSchema } from "./chunk-3VOOG6SX.js"; // src/schemas/sdo/data-source.schema.ts import { z } from "zod/v4"; var supportedMitreCollectionLayers = [ "Cloud Control Plane", "Host", "Report", "Container", "Device", "OSINT", "Network" ]; var xMitreCollectionLayersSchema = z.array(z.enum(supportedMitreCollectionLayers), { error: (issue) => issue.code === "invalid_type" ? "x_mitre_collection_layers must be an array of supported collection layers." : "x_mitre_collection_layers is invalid or missing" }).min(1).meta({ description: "List of places the data can be collected from." }); var dataSourceSchema = attackBaseDomainObjectSchema.extend({ id: createStixIdValidator("x-mitre-data-source"), type: createStixTypeValidator("x-mitre-data-source"), description: descriptionSchema, // Optional in STIX but required in ATT&CK external_references: createAttackExternalReferencesSchema("x-mitre-data-source"), x_mitre_platforms: xMitrePlatformsSchema.optional(), x_mitre_domains: xMitreDomainsSchema, x_mitre_modified_by_ref: xMitreModifiedByRefSchema, x_mitre_contributors: xMitreContributorsSchema.optional(), x_mitre_collection_layers: xMitreCollectionLayersSchema }).required({ created_by_ref: true, // Optional in STIX but required in ATT&CK object_marking_refs: true // Optional in STIX but required in ATT&CK }).strict().meta({ description: ` > [!WARNING] > **Deprecation Notice**: Data Sources (\`x-mitre-data-source\`) are deprecated as of ATT&CK Specification 3.3.0 and superseded by the Detection Strategy framework. > They remain supported for backward compatibility but will be removed in ATT&CK Specification 4.0.0. Data sources represent categories of information that can be collected for detection purposes. They are defined as \`x-mitre-data-source\` objects extending the generic [STIX Domain Object pattern](https://docs.oasis-open.org/cti/stix/v2.0/csprd01/part2-stix-objects/stix-v2.0-csprd01-part2-stix-objects.html#_Toc476230920). `.trim() }); export { xMitreCollectionLayersSchema, dataSourceSchema };