UNPKG

@mitre-attack/attack-data-model

Version:

A TypeScript API for the MITRE ATT&CK data model

675 lines (658 loc) 28.5 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/schemas/sdo/analytic.schema.ts var analytic_schema_exports = {}; __export(analytic_schema_exports, { analyticSchema: () => analyticSchema, extensibleAnalyticSchema: () => extensibleAnalyticSchema, xMitreLogSourcePermutationKey: () => xMitreLogSourcePermutationKey, xMitreLogSourceRefSchema: () => xMitreLogSourceRefSchema, xMitreLogSourceRefsSchema: () => xMitreLogSourceRefsSchema, xMitreMutableElementSchema: () => xMitreMutableElementSchema, xMitreMutableElementsSchema: () => xMitreMutableElementsSchema }); module.exports = __toCommonJS(analytic_schema_exports); var import_v411 = require("zod/v4"); // src/schemas/common/attack-base-object.ts var import_v410 = require("zod/v4"); // src/schemas/common/stix-core.ts var import_v49 = require("zod/v4"); // src/schemas/common/stix-identifier.ts var import_v42 = require("zod/v4"); // src/schemas/common/stix-type.ts var import_v4 = require("zod/v4"); var stixTypeToTypeName = { "attack-pattern": "Technique", bundle: "StixBundle", campaign: "Campaign", "course-of-action": "Mitigation", "extension-definition": null, identity: "Identity", "intrusion-set": "Group", malware: "Malware", tool: "Tool", "marking-definition": "MarkingDefinition", "x-mitre-analytic": "Analytic", "x-mitre-data-component": "DataComponent", "x-mitre-detection-strategy": "DetectionStrategy", "x-mitre-data-source": "DataSource", "x-mitre-log-source": "LogSource", "x-mitre-tactic": "Tactic", "x-mitre-asset": "Asset", "x-mitre-matrix": "Matrix", "x-mitre-collection": "Collection", relationship: "Relationship", file: "", // not used in ATT&CK but used in sample_refs for Malware artifact: "" // not used in ATT&CK but used in sample_refs for Malware // 'observed-data': 'ObservedData', // not used in ATT&CK // 'report': 'Report', // not used in ATT&CK // 'threat-actor': 'ThreatActor', // not used in ATT&CK // 'vulnerability': 'Vulnerability', // not used in ATT&CK }; var supportedStixTypes = [ "attack-pattern", "bundle", "campaign", "course-of-action", "extension-definition", "identity", "intrusion-set", "malware", "tool", "marking-definition", "x-mitre-analytic", "x-mitre-data-component", "x-mitre-detection-strategy", "x-mitre-tactic", "x-mitre-asset", "x-mitre-data-source", "x-mitre-log-source", "x-mitre-matrix", "x-mitre-collection", "relationship", "file", // not used in ATT&CK but used in sample_refs for Malware "artifact" // not used in ATT&CK but used in sample_refs for Malware // "indicator", // not used in ATT&CK // "observed-data", // not used in ATT&CK // "report", // not used in ATT&CK // "threat-actor", // not used in ATT&CK // "vulnerability", // not used in ATT&CK ]; var stixTypeSchema = import_v4.z.enum(supportedStixTypes, { error: (issue) => { if (issue.code === "invalid_value") { const received = typeof issue.input === "string" ? issue.input : String(issue.input); return `Invalid STIX type '${received}'. Expected one of the supported STIX types.`; } return void 0; } }).meta({ description: "The type property identifies the type of STIX Object (SDO, Relationship Object, etc). The value of the type field MUST be one of the types defined by a STIX Object (e.g., indicator)." }); function createStixTypeValidator(stixType) { const objectName = stixTypeToTypeName[stixType]; return import_v4.z.literal(stixType).refine((val) => val === stixType, { error: (issue) => `Invalid 'type' property. Expected '${stixType}' for ${objectName} object, but received '${issue.input}'.` }); } // src/schemas/common/stix-identifier.ts var stixIdentifierSchema = import_v42.z.string().refine((val) => val.includes("--") && val.split("--").length === 2, { error: (issue) => ({ code: "custom", message: "Invalid STIX Identifier: must comply with format 'type--UUIDv4'", input: issue.input, path: [] }) }).refine( (val) => { const [type] = val.split("--"); return stixTypeSchema.safeParse(type).success; }, { error: (issue) => { const val = issue.input; const [type] = val.split("--"); const typeName = type in stixTypeToTypeName ? stixTypeToTypeName[type] : "STIX"; return { code: "custom", message: `Invalid STIX Identifier for ${typeName} object: contains invalid STIX type '${type}'`, input: issue.input, path: [] }; } } ).refine( (val) => { const [, uuid] = val.split("--"); return import_v42.z.uuid().safeParse(uuid).success; }, { error: (issue) => { const val = issue.input; const [type] = val.split("--"); const typeName = type in stixTypeToTypeName ? stixTypeToTypeName[type] : "STIX"; return { code: "custom", message: `Invalid STIX Identifier for ${typeName} object: contains invalid UUIDv4 format`, input: issue.input, path: [] }; } } ).meta({ description: "Represents identifiers across the CTI specifications. The format consists of the name of the top-level object being identified, followed by two dashes (--), followed by a UUIDv4." }); function createStixIdValidator(expectedType) { return stixIdentifierSchema.refine( (val) => val.startsWith(`${expectedType}--`), { error: () => ({ code: "custom", message: `Invalid STIX Identifier: must start with '${expectedType}--'`, input: expectedType, path: [] }) } ); } // src/schemas/common/stix-spec-version.ts var import_v43 = require("zod/v4"); var specVersionDescription = [ "The version of the STIX specification used to represent this object.", "The value of this property MUST be 2.1 for STIX Objects defined according to this specification.", "If objects are found where this property is not present, the implicit value for all STIX Objects other than SCOs is 2.0.", "Since SCOs are now top-level objects in STIX 2.1, the default value for SCOs is 2.1." ].join(" "); var stixSpecVersionSchema = import_v43.z.enum(["2.0", "2.1"]).meta({ description: specVersionDescription }); // src/schemas/common/stix-timestamp.ts var import_v44 = require("zod/v4"); var stixTimestampSchema = import_v44.z.iso.datetime({ error: "Invalid STIX timestamp format: must be an RFC3339 timestamp with a timezone specification of 'Z'." }).refine((val) => val.endsWith("Z"), { message: "STIX timestamps must use 'Z' timezone specification" }).meta({ description: "Represents timestamps across the CTI specifications. The format is an RFC3339 timestamp, with a required timezone specification of 'Z'." }); var stixCreatedTimestampSchema = stixTimestampSchema.brand(); var stixModifiedTimestampSchema = stixTimestampSchema.brand(); // src/schemas/common/misc.ts var import_v46 = require("zod/v4"); // src/schemas/common/attack-id.ts var import_v45 = require("zod/v4"); var attackIdConfig = { tactic: { pattern: /^TA\d{4}$/, message: "Must match ATT&CK Tactic ID format (TA####)", example: "TA####", stixTypes: ["x-mitre-tactic"] }, technique: { pattern: /^T\d{4}$/, message: "Must match ATT&CK Technique ID format (T####)", example: "T####", stixTypes: ["attack-pattern"] // Note: attack-pattern can be technique or subtechnique }, subtechnique: { pattern: /^T\d{4}\.\d{3}$/, message: "Must match ATT&CK Sub-technique ID format (T####.###)", example: "T####.###", stixTypes: ["attack-pattern"] // Note: attack-pattern can be technique or subtechnique }, group: { pattern: /^G\d{4}$/, message: "Must match ATT&CK Group ID format (G####)", example: "G####", stixTypes: ["intrusion-set"] }, software: { pattern: /^S\d{4}$/, message: "Must match ATT&CK Software ID format (S####)", example: "S####", stixTypes: ["malware", "tool"] }, mitigation: { pattern: /^M\d{4}$/, message: "Must match ATT&CK Mitigation ID format (M####)", example: "M####", stixTypes: ["course-of-action"] }, asset: { pattern: /^A\d{4}$/, message: "Must match ATT&CK Asset ID format (A####)", example: "A####", stixTypes: ["x-mitre-asset"] }, "data-source": { pattern: /^DS\d{4}$/, message: "Must match ATT&CK Data Source ID format (DS####)", example: "DS####", stixTypes: ["x-mitre-data-source"] }, "log-source": { pattern: /^LS\d{4}$/, message: "Must match ATT&CK Log Source ID format (DS####)", example: "LS####", stixTypes: ["x-mitre-log-source"] }, campaign: { pattern: /^C\d{4}$/, message: "Must match ATT&CK Campaign ID format (C####)", example: "C####", stixTypes: ["campaign"] }, "data-component": { pattern: /^DC\d{4}$/, message: "Must match ATT&CK Data Component Source ID format (DC####)", example: "DC####", stixTypes: ["x-mitre-data-component"] }, "detection-strategy": { pattern: /^DET\d{4}$/, message: "Must match ATT&CK Detection Strategy Source ID format (DET####)", example: "DET####", stixTypes: ["x-mitre-detection-strategy"] }, analytic: { pattern: /^AN\d{4}$/, message: "Must match ATT&CK Analytic Source ID format (AN####)", example: "AN####", stixTypes: ["x-mitre-analytic"] } }; var stixTypeToAttackIdMapping = { "x-mitre-tactic": "tactic", "attack-pattern": "technique", // Default to technique; subtechnique handling is done contextually "intrusion-set": "group", malware: "software", tool: "software", "course-of-action": "mitigation", "x-mitre-asset": "asset", "x-mitre-data-source": "data-source", campaign: "campaign", "x-mitre-data-component": "data-component", "x-mitre-log-source": "log-source", "x-mitre-detection-strategy": "detection-strategy", "x-mitre-analytic": "analytic" }; var attackIdPatterns = Object.fromEntries( Object.entries(attackIdConfig).map(([key, config]) => [key, config.pattern]) ); var attackIdMessages = Object.fromEntries( Object.entries(attackIdConfig).map(([key, config]) => [key, config.message]) ); var attackIdExamples = Object.fromEntries( Object.entries(attackIdConfig).map(([key, config]) => [key, config.example]) ); function getAttackIdExample(stixType) { if (stixType === "attack-pattern") { return `${attackIdExamples.technique} or ${attackIdExamples.subtechnique}`; } const attackIdType = stixTypeToAttackIdMapping[stixType]; return attackIdExamples[attackIdType]; } // src/schemas/common/misc.ts var externalReferenceSchema = import_v46.z.object({ source_name: import_v46.z.string({ error: (issue) => issue.input === void 0 ? "Source name is required" : "Source name must be a string" }), description: import_v46.z.string({ error: "Description must be a string" }).optional(), url: import_v46.z.url({ error: (issue) => issue.input === null ? "URL cannot be null" : "Invalid URL format. Please provide a valid URL" }).optional(), external_id: import_v46.z.string({ error: "External ID must be a string" }).optional() }); var externalReferencesSchema = import_v46.z.array(externalReferenceSchema).min(1, "At least one external reference is required when 'external_references' is defined").meta({ description: "A list of external references which refers to non-STIX information" }); var createAttackExternalReferencesSchema = (stixType) => { return import_v46.z.array(externalReferenceSchema).min(1, "At least one external reference is required").refine((refs) => !!refs[0]?.external_id, { message: "ATT&CK ID must be defined in the first external_references entry.", path: [0, "external_id"] }).refine( (refs) => { if (!refs[0]?.external_id) return true; const attackIdType = stixTypeToAttackIdMapping[stixType]; if (attackIdType === "technique") { return attackIdPatterns["technique"].test(refs[0].external_id) || attackIdPatterns["subtechnique"].test(refs[0].external_id); } return attackIdPatterns[attackIdType].test(refs[0].external_id); }, { message: `The first external_reference must match the ATT&CK ID format ${getAttackIdExample(stixType)}.`, path: [0, "external_id"] } ).meta({ description: "A list of external references with the first containing a valid ATT&CK ID" }); }; var stixCreatedByRefSchema = createStixIdValidator("identity").meta({ description: "The created_by_ref property specifies the id property of the identity object that describes the entity that created this object. If this attribute is omitted, the source of this information is undefined. This may be used by object creators who wish to remain anonymous." }); var granularMarkingSchema = import_v46.z.object({ marking_ref: stixIdentifierSchema, selectors: import_v46.z.array(import_v46.z.string()) }); // src/schemas/common/common-properties.ts var import_v47 = require("zod/v4"); var versionSchema = import_v47.z.string().regex(/^\d+\.\d+$/, "Version must be in the format 'major.minor'").default("2.1").meta({ description: "Represents the version of the object in a 'major.minor' format, where both 'major' and 'minor' are integers. This versioning follows semantic versioning principles but excludes the patch number. The version number is incremented by ATT&CK when the content of the object is updated. This property does not apply to relationship objects." }); var nameSchema = import_v47.z.string().min(1, "Name must not be empty").meta({ description: "The name of the object." }); var descriptionSchema = import_v47.z.string().meta({ description: "A description of the object." }); var aliasesSchema = import_v47.z.array(import_v47.z.string(), { error: "Aliases must be an array of strings." }).meta({ description: "Alternative names used to identify this object. The first alias must match the object's name." }); var xMitreVersionSchema = import_v47.z.string().regex(/^(\d{1,2})\.(\d{1,2})$/, "Version must be in format 'M.N' where M and N are 0-99").meta({ description: "Represents the version of the object in a 'major.minor' format, where both 'major' and 'minor' are integers between 0 and 99. This versioning follows semantic versioning principles but excludes the patch number. The version number is incremented by ATT&CK when the content of the object is updated. This property does not apply to relationship objects." }); var semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/; var xMitreAttackSpecVersionSchema = import_v47.z.string().regex(semverRegex, "Must be valid semantic version (MAJOR.MINOR.PATCH)").meta({ description: "The version of the ATT&CK spec used by the object. This field helps consuming software determine if the data format is supported. If the field is not present on an object, the spec version will be assumed to be 2.0.0. Refer to the ATT&CK CHANGELOG for all supported versions." }); var oldAttackIdRegex = /^MOB-(M|S)\d{4}$/; var xMitreOldAttackIdSchema = import_v47.z.string().refine( (value) => { return oldAttackIdRegex.test(value); }, { message: "Must be in the format 'MOB-X0000' where X is either 'M' or 'S', followed by exactly four digits" } ).meta({ description: "Old ATT&CK IDs that may have been associated with this object" }); var attackDomainSchema = import_v47.z.enum(["enterprise-attack", "mobile-attack", "ics-attack"]); var xMitreDomainsSchema = import_v47.z.array(attackDomainSchema).min(1, { message: "At least one MITRE ATT&CK domain must be specified." }).meta({ description: "The technology domains to which the ATT&CK object belongs." }); var xMitreDeprecatedSchema = import_v47.z.boolean({ error: "x_mitre_deprecated must be a boolean." }).meta({ description: "Indicates whether the object has been deprecated." }); 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 = import_v47.z.enum(supportedMitrePlatforms, { error: () => `Platform must be one of: ${supportedMitrePlatforms.join(", ")}` }); var xMitrePlatformsSchema = import_v47.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." }); var objectMarkingRefsSchema = import_v47.z.array( stixIdentifierSchema.startsWith( "marking-definition--", 'Identifier must start with "marking-definition--"' ) ).meta({ description: "The list of marking-definition objects to be applied to this object." }); var xMitreContributorsSchema = import_v47.z.array(import_v47.z.string().nonempty()).meta({ description: "People and organizations who have contributed to the object. Not found on objects of type `relationship`." }).nonempty(); var xMitreIdentity = "identity--c78cb6e5-0c4b-4611-8297-d1b8b55e40b5"; var xMitreIdentitySchema = import_v47.z.literal(xMitreIdentity); var xMitreModifiedByRefSchema = xMitreIdentitySchema.meta({ description: "The STIX ID of the MITRE identity object. Used to track the identity of the MITRE organization, which created the current version of the object. Previous versions of the object may have been created by other individuals or organizations." }); var killChainNameSchema = import_v47.z.enum([ "mitre-attack", "mitre-mobile-attack", "mitre-ics-attack" ]); var killChainPhaseSchema = import_v47.z.object({ phase_name: import_v47.z.string({ error: (issue) => issue.input === void 0 ? "Phase name is required" : "Phase name must be a string" }).refine( (value) => { const isLowercase = value === value.toLowerCase(); const usesHyphens = !value.includes(" ") && !value.includes("_"); return isLowercase && usesHyphens; }, { message: "Phase name should be all lowercase and use hyphens instead of spaces or underscores." } ).meta({ description: "The name of the phase in the kill chain. The value of this property SHOULD be all lowercase and SHOULD use hyphens instead of spaces or underscores as word separators." }), kill_chain_name: killChainNameSchema }).strict(); // src/schemas/common/extensions.ts var import_v48 = require("zod/v4"); var extensionTypeSchema = import_v48.z.enum([ "new-sdo", "new-sco", "new-sro", "property-extension", "toplevel-property-extension" ]); var extensionSchema = import_v48.z.object({ extension_type: extensionTypeSchema // Additional properties depend on extension type - using record for flexibility }).catchall(import_v48.z.unknown()); var extensionsSchema = import_v48.z.record(import_v48.z.string(), import_v48.z.union([extensionSchema, import_v48.z.record(import_v48.z.string(), import_v48.z.unknown())])).meta({ description: "Specifies any extensions of the object, as a dictionary where keys are extension definition UUIDs" }); var extensionPropertyNameSchema = import_v48.z.string().min(3, "Extension property names must be at least 3 characters").max(250, "Extension property names must be no longer than 250 characters").regex( /^[a-z0-9_]+$/, "Extension property names must only contain lowercase letters, digits, and underscores" ); var extensionObjectTypeSchema = import_v48.z.string().min(3, "Extension object type must be at least 3 characters").max(250, "Extension object type must be no longer than 250 characters").regex( /^[a-z0-9-]+$/, "Extension object type must only contain lowercase letters, digits, and hyphens" ).refine( (value) => !value.includes("--"), "Extension object type must not contain consecutive hyphens" ); var extensionDefinitionSchema = import_v48.z.object({ // Required common properties id: createStixIdValidator("extension-definition"), type: createStixTypeValidator("extension-definition"), spec_version: stixSpecVersionSchema, created: import_v48.z.iso.datetime(), modified: import_v48.z.iso.datetime(), created_by_ref: stixCreatedByRefSchema, // Optional common properties revoked: import_v48.z.boolean().optional(), labels: import_v48.z.array(import_v48.z.string()).optional(), external_references: externalReferencesSchema.optional(), object_marking_refs: objectMarkingRefsSchema.optional(), granular_markings: import_v48.z.array(granularMarkingSchema).optional(), // Extension definition specific properties name: nameSchema, description: import_v48.z.string({ error: "Description must be a string" }).optional(), schema: import_v48.z.string({ error: "Schema must be a string" }), version: import_v48.z.string({ error: "Version must be a string" }).regex(/^\d+\.\d+\.\d+$/, "Version must follow semantic versioning (MAJOR.MINOR.PATCH)"), extension_types: import_v48.z.array(extensionTypeSchema).min(1, "At least one extension type is required"), extension_properties: import_v48.z.array(extensionPropertyNameSchema).optional() }).strict().refine( (data) => { if (data.extension_types.includes("toplevel-property-extension")) { return data.extension_properties && data.extension_properties.length > 0; } return true; }, { message: "extension_properties must be provided when extension_types includes toplevel-property-extension" } ).meta({ description: "Extension Definition object allows producers to extend existing STIX objects or create new STIX objects" }); // src/schemas/common/stix-core.ts var stixBaseObjectSchema = import_v49.z.object({ id: stixIdentifierSchema.meta({ description: "The id property universally and uniquely identifies this object." }), type: stixTypeSchema, spec_version: stixSpecVersionSchema.meta({ description: "The version of the STIX specification used to represent this object." }), created: stixCreatedTimestampSchema.meta({ description: "The created property represents the time at which the first version of this object was created. The timstamp value MUST be precise to the nearest millisecond." }), modified: stixModifiedTimestampSchema.meta({ description: "The modified property represents the time that this particular version of the object was modified. The timstamp value MUST be precise to the nearest millisecond." }), created_by_ref: stixCreatedByRefSchema.optional(), labels: import_v49.z.array(import_v49.z.string()).meta({ description: "The labels property specifies a set of terms used to meta this object." }).optional(), revoked: import_v49.z.boolean().meta({ description: "The revoked property indicates whether the object has been revoked." }).optional(), confidence: import_v49.z.number().meta({ description: "Identifies the confidence that the creator has in the correctness of their data." }).int().min(1).max(99).optional().refine((val) => val === void 0 || val > 0 && val < 100, { message: "Confidence must be between 1 and 99 inclusive." }).optional(), lang: import_v49.z.string().meta({ description: "Identifies the language of the text content in this object." }).optional(), external_references: externalReferencesSchema.optional(), object_marking_refs: objectMarkingRefsSchema.optional(), granular_markings: import_v49.z.array(granularMarkingSchema).meta({ description: "The set of granular markings that apply to this object." }).optional(), extensions: extensionsSchema.optional() }).strict(); var stixDomainObjectSchema = stixBaseObjectSchema.extend({}); var stixRelationshipObjectSchema = stixBaseObjectSchema.extend({}); // src/schemas/common/attack-base-object.ts var attackBaseObjectSchema = stixDomainObjectSchema.extend({ name: nameSchema, /** * Required on all ATT&CK schemas except: * - Marking Definition */ x_mitre_attack_spec_version: xMitreAttackSpecVersionSchema, /** * Required on all ATT&CK schemas except: * - Marking Definition * - Identity * - Relationship */ x_mitre_version: xMitreVersionSchema, x_mitre_old_attack_id: xMitreOldAttackIdSchema.optional(), x_mitre_deprecated: xMitreDeprecatedSchema.optional() }); var attackBaseDomainObjectSchema = attackBaseObjectSchema.extend({}); var attackBaseRelationshipObjectSchema = attackBaseObjectSchema.extend({}); var attackBaseMetaObjectSchema = attackBaseObjectSchema.extend({}).omit({ modified: true }); // src/schemas/sdo/analytic.schema.ts var xMitreLogSourcePermutationKey = import_v411.z.string(); var xMitreLogSourceRefSchema = import_v411.z.object({ ref: createStixIdValidator("x-mitre-log-source"), keys: import_v411.z.array(import_v411.z.string()).nonempty().meta({ description: "Must match one of the elements in the ``x_mitre_log_source_permutations`` array" }).nonempty() }).meta({ description: "A reference to a log source permutation" }); var xMitreLogSourceRefsSchema = import_v411.z.array(xMitreLogSourceRefSchema).nonempty().refine( // Reject duplicate refs (cannot reference the same log source twice) // Reject duplicate key elements for each ref (cannot reference the same key twice) (logSourceRefs) => { const seenRefs = /* @__PURE__ */ new Set(); for (const logSourceRef of logSourceRefs) { if (seenRefs.has(logSourceRef.ref)) { return false; } seenRefs.add(logSourceRef.ref); const seenKeys = /* @__PURE__ */ new Set(); for (const key of logSourceRef.keys) { if (seenKeys.has(key)) { return false; } seenKeys.add(key); } } return true; }, { message: "Duplicate log source permutation found: each (name, channel) pair must be unique", path: ["x_mitre_log_source_permutations"] } ).meta({ description: "A list of log source STIX IDs, plus the specific channel or event type, e.g., sysmon:1 or auditd:SYSCALL." }); var xMitreMutableElementSchema = import_v411.z.object({ field: import_v411.z.string().nonempty(), description: import_v411.z.string().nonempty() }); var xMitreMutableElementsSchema = import_v411.z.array(xMitreMutableElementSchema).nonempty().meta({ description: "Environment-specific tuning knobs like TimeWindow, UserContext, or PortRange, so defenders can adapt without changing core behavior." }); var extensibleAnalyticSchema = attackBaseDomainObjectSchema.extend({ id: createStixIdValidator("x-mitre-analytic"), type: createStixTypeValidator("x-mitre-analytic"), x_mitre_platforms: xMitrePlatformsSchema.max(1), // 0 or 1 x_mitre_detects: import_v411.z.string().nonempty().meta({ description: "A tool-agnostic description of the adversary behavior chain this analytic looks for." }), external_references: createAttackExternalReferencesSchema("x-mitre-analytic"), x_mitre_log_sources: xMitreLogSourceRefsSchema, x_mitre_mutable_elements: xMitreMutableElementsSchema, x_mitre_domains: xMitreDomainsSchema }).required({ created_by_ref: true, object_marking_refs: true }).strict(); var analyticSchema = extensibleAnalyticSchema; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { analyticSchema, extensibleAnalyticSchema, xMitreLogSourcePermutationKey, xMitreLogSourceRefSchema, xMitreLogSourceRefsSchema, xMitreMutableElementSchema, xMitreMutableElementsSchema });