@mitre-attack/attack-data-model
Version:
A TypeScript API for the MITRE ATT&CK data model
59 lines (56 loc) • 1.92 kB
JavaScript
import {
attackBaseDomainObjectSchema
} from "./chunk-ZQ5CIHH7.js";
import {
descriptionSchema,
xMitreContributorsSchema,
xMitreDomainsSchema,
xMitreModifiedByRefSchema,
xMitrePlatformsSchema
} from "./chunk-Z7F5EWOT.js";
import {
createAttackExternalReferencesSchema
} from "./chunk-QY7EQ3UO.js";
import {
createStixIdValidator
} from "./chunk-OM2DJ5DL.js";
import {
createStixTypeValidator
} from "./chunk-5JU73PGM.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"
}).meta({ description: "List of places the data can be collected from." });
var extensibleDataSourceSchema = 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();
var dataSourceSchema = extensibleDataSourceSchema;
export {
xMitreCollectionLayersSchema,
extensibleDataSourceSchema,
dataSourceSchema
};