Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
524cdc3
feat: implement Validated base class and refactor TechniqueImpl
seansica Jul 21, 2025
88fe24c
Merge branch 'main' into 37-overhaul-es6-class-implementations
seansica Aug 15, 2025
8f45e19
refactor: rename src/classes to src/api
seansica Aug 15, 2025
ec0f214
refactor: move getters and generator to new src/utils package
seansica Aug 15, 2025
30868f1
refactor: consolidate src/data-sources with src/main.ts
seansica Aug 15, 2025
c8ed830
refactor: move src/refinements to src/schemas/refinements
seansica Aug 15, 2025
58824e8
refactor: update imports in index.ts files
seansica Aug 15, 2025
ad7c60c
docs: update code cell in usage documentation
seansica Aug 15, 2025
539eb3a
Merge branch 'main' into 37-overhaul-es6-class-implementations
seansica Sep 16, 2025
52f3cf1
fix: post merge cleanup
seansica Sep 16, 2025
7b10be2
refactor(api): rename data source concepts to content origin
seansica Sep 16, 2025
76111f4
fix: update import paths for refinements
seansica Sep 16, 2025
0dd94d1
fix: update import paths for generator
seansica Sep 16, 2025
1f7c3b2
fix: update documentation unit tests
seansica Sep 16, 2025
f8e246d
refactor(api): optimize setter method logic in technique.impl class
seansica Sep 18, 2025
821a65e
Merge branch 'main' into 37-overhaul-es6-class-implementations
seansica Oct 20, 2025
dbb67c7
fix: update import paths in refinements module
seansica Oct 20, 2025
f390b47
Merge branch 'next' into 37-overhaul-es6-class-implementations
seansica May 8, 2026
7226c05
fix: update import paths
seansica May 11, 2026
eaa9b0a
fix(validated): resolve zod type error
seansica May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 28 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Built on STIX 2.1 compliance, it uses Zod schemas and TypeScript types to ensure

- **Type-Safe Data Parsing**: ADM validates STIX 2.1 bundles using Zod schemas, ensuring data model compliance and type safety.
- **Easy Relationship Navigation**: Each object instance contains pointers to related objects, simplifying the process of navigating between techniques, tactics, and other ATT&CK elements.
- **Supports Multiple Data Sources**: Load ATT&CK datasets from different sources, including GitHub, local files, URLs, and TAXII 2.1 servers (more data sources in development).
- **Supports Multiple Content Origins**: Load ATT&CK datasets from different content origins, including GitHub, local files, URLs, and TAXII 2.1 servers (more content origins in development).
- Parsing, validation, and serialization of ATT&CK data
- ES6 classes for object-oriented data manipulation

## Supported Data Sources
## Supported Content Origins

- **`attack`**: Load ATT&CK data from the official MITRE ATT&CK STIX 2.1 GitHub repository. This serves as the source of truth for MITRE ATT&CK content.
- **`mitre`**: Load ATT&CK data from the official MITRE ATT&CK STIX 2.1 GitHub repository. This serves as the source of truth for MITRE ATT&CK content.
- **`file`**: Load ATT&CK data from a local JSON file containing a STIX 2.1 bundle.
- **`url`**: Load ATT&CK data from a URL endpoint serving STIX 2.1 content.
- **`taxii`**: (Coming soon) Load ATT&CK data from a TAXII 2.1 server.
Expand Down Expand Up @@ -93,21 +93,17 @@ For most users, we recommend:
Example of loading the latest ATT&CK data:

```javascript
import {
registerDataSource,
loadDataModel,
DataSourceRegistration,
} from '@mitre-attack/attack-data-model';

const dataSource = new DataSourceRegistration({
source: 'attack',
domain: 'enterprise-attack',
version: '17.1',
parsingMode: 'strict',
import { registerContentOrigin, loadDataModel, ContentOriginRegistration } from '@mitre-attack/attack-data-model';

const contentOrigin = new ContentOriginRegistration({
source: 'mitre',
domain: 'enterprise-attack',
version: '17.1',
parsingMode: 'strict'
});

const dataSource = await registerDataSource(dataSource);
const attackEnterpriseLatest = loadDataModel(dataSource);
const dataSourceId = await registerContentOrigin(contentOrigin);
const attackEnterpriseLatest = loadDataModel(dataSourceId);
```

For more details on version compatibility, see the [Compatibility Guide](https://mitre-attack.github.io/attack-data-model/docs/principles/attack-versioning).
Expand Down Expand Up @@ -139,27 +135,24 @@ For additional context about the ATT&CK specification, please refer to the [ATT&
Here's an example script that demonstrates how to use the ADM library to load ATT&CK data from the official MITRE ATT&CK GitHub repository:

```typescript
import {
registerDataSource,
loadDataModel,
DataSourceRegistration,
} from '@mitre-attack/attack-data-model';
import { registerContentOrigin, loadDataModel, ContentOriginRegistration } from '@mitre-attack/attack-data-model';

(async () => {
// Instantiating a DataSourceRegistration object will validate that the data source is accessible and readable
const dataSource = new DataSourceRegistration({
source: 'attack', // Built-in index to retrieve ATT&CK content from the official MITRE ATT&CK STIX 2.1 GitHub repository
domain: 'enterprise-attack',
version: '15.1', // Omitting 'version' will default to the latest version available in the repository
parsingMode: 'relaxed', // 'strict' or 'relaxed' - 'relaxed' mode will attempt to parse and serialize data even if it contains errors or warnings
});

try {
// Register the data source and retrieve the unique ID
const uuid = await registerDataSource(dataSource);
if (uuid) {
// Load the dataset using the unique ID
const attackEnterpriseLatest = loadDataModel(uuid);
// Instantiating a ContentOriginRegistration object will validate that the content origin is accessible and readable
const contentOrigin = new ContentOriginRegistration({
source: 'mitre', // Built-in index to retrieve ATT&CK content from the official MITRE ATT&CK STIX 2.1 GitHub repository
domain: 'enterprise-attack',
version: '15.1', // Omitting 'version' will default to the latest version available in the repository
parsingMode: 'relaxed' // 'strict' or 'relaxed' - 'relaxed' mode will attempt to parse and serialize data even if it contains errors or warnings
});

try {
// Register the content origin and retrieve the unique ID
const uuid = await registerContentOrigin(contentOrigin);
if (uuid) {
// Load the dataset using the unique ID
const attackEnterpriseLatest = loadDataModel(uuid);

// Access ATT&CK objects by type using object properties
const techniques = attackEnterpriseLatest.techniques;
Expand Down Expand Up @@ -226,7 +219,7 @@ For more detailed examples, please refer to the [examples](./examples/README.md)

## How It Works

1. **Data Registration**: Datasets are registered via `registerDataSource`. You specify the source of the data (e.g., `attack`, `file`, `url`, `taxii`) and provide any necessary options (such as `domain` and `version` for ATT&CK datasets). This function returns a unique identifier for the registered data source.
1. **Content Origin Registration**: Datasets are registered via `registerContentOrigin`. You specify the content origin (e.g., `mitre`, `file`, `url`, `taxii`) and provide any necessary options (such as `domain` and `version` for ATT&CK datasets). This function returns a unique identifier for the registered content origin.
2. **Data Loading**: The `loadDataModel` function is used to load registered data models by their unique identifier.
3. **Parsing and Validation**: Once the data is loaded, it is parsed by Zod schemas, ensuring that the data conforms to the expected STIX 2.1 specification.
4. **Serialization**: Valid objects are converted into TypeScript class instances, allowing for type-safe interaction and relationship navigation.
Expand Down
43 changes: 21 additions & 22 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The ATT&CK Data Model (ADM) TypeScript API provides a structured and type-safe w
- **Type-Safe Data Parsing**: Validates STIX 2.1 data using Zod schemas, ensuring compliance with the ATT&CK Data Model.
- **Object-Oriented Interface**: Provides ES6 class wrappers for ATT&CK objects, enabling intuitive interaction and relationship navigation.
- **Relationship Mapping**: Automatically processes relationships between objects, allowing easy traversal of the ATT&CK data model.
- **Flexible Data Sources**: Supports loading data from various sources, including the official MITRE ATT&CK GitHub repository, local files, URLs, and TAXII 2.1 servers (some data sources are under development).
- **Flexible Content Origins**: Supports loading data from various content origins, including the official MITRE ATT&CK GitHub repository, local files, URLs, and TAXII 2.1 servers (some content origins are under development).

## Installation

Expand Down Expand Up @@ -65,7 +65,7 @@ When installed, the library has the following directory structure:
│ ├── sdo
│ ├── smo
│ └── sro
├── data-sources
├── content-origins
├── errors
└── schemas
├── common
Expand All @@ -84,16 +84,15 @@ Each sub-package serves a specific purpose:
- **`classes`**: Contains ES6 class wrappers for ATT&CK objects, providing methods for relationship navigation and data manipulation.
- **`common`**: Base classes and shared components.
- **`sdo`**, **`smo`**, **`sro`**: Class implementations corresponding to the schemas.
- **`data-sources`**: Modules for loading ATT&CK data from various sources.
- **`content-origins`**: Modules for loading ATT&CK data from various content origins.
- **`errors`**: Custom error classes used throughout the library.

### Hierarchical Structure

The library is designed with a hierarchical structure. Every directory exports its modules through an `index.ts` file, creating a clear and organized namespace. The top-level `index.ts` file exports all components, allowing for straightforward imports:

```typescript
export * from './classes/index.js';
export * from './data-sources/index.js';
export * from './api/index.js';
export * from './errors/index.js';
export * from './schemas/index.js';
export * from './main.js';
Expand Down Expand Up @@ -210,20 +209,20 @@ console.log(attackDataModel.campaigns); // Access campaigns

### Initializing with Data

To use the `AttackDataModel`, you need to load it with data from a data source:
To use the `AttackDataModel`, you need to load it with data from a content origin:

```typescript
import { registerDataSource, loadDataModel, DataSource } from '@mitre-attack/attack-data-model';
import { registerContentOrigin, loadDataModel, ContentOriginRegistration } from '@mitre-attack/attack-data-model';

(async () => {
const dataSource = new DataSource({
source: 'attack',
const contentOrigin = new ContentOriginRegistration({
source: 'mitre',
domain: 'enterprise-attack',
version: '15.1',
parsingMode: 'relaxed',
});

const uuid = await registerDataSource(dataSource);
const uuid = await registerContentOrigin(contentOrigin);
const attackDataModel = loadDataModel(uuid);

// Now you can interact with the data model
Expand Down Expand Up @@ -289,31 +288,31 @@ console.log(campaign.name);
const techniques = campaign.getTechniques();
```

## Data Sources
## Content Origins

The library supports loading data from various sources through the `DataSource` class.
The library supports loading data from various content origins through the `ContentOriginRegistration` class.

### Supported Data Sources
### Supported Content Origins

- **`attack`**: Official MITRE ATT&CK STIX 2.1 GitHub repository.
- **`mitre`**: Official MITRE ATT&CK STIX 2.1 GitHub repository.
- **`file`**: (Coming soon) Local JSON files containing STIX 2.1 bundles.
- **`url`**: (Coming soon) URLs serving STIX 2.1 content.
- **`taxii`**: (Coming soon) TAXII 2.1 servers.

### Loading Data from the ATT&CK GitHub Repository

```typescript
import { registerDataSource, loadDataModel, DataSource } from '@mitre-attack/attack-data-model';
import { registerContentOrigin, loadDataModel, ContentOriginRegistration } from '@mitre-attack/attack-data-model';

(async () => {
const dataSource = new DataSource({
source: 'attack',
const contentOrigin = new ContentOriginRegistration({
source: 'mitre',
domain: 'enterprise-attack',
version: '15.1',
parsingMode: 'relaxed',
});

const uuid = await registerDataSource(dataSource);
const uuid = await registerContentOrigin(contentOrigin);
const attackDataModel = loadDataModel(uuid);

// Access ATT&CK objects
Expand Down Expand Up @@ -455,18 +454,18 @@ try {

## Advanced Usage

### Custom Data Sources
### Custom Content Origins

You can create custom data sources by extending the `DataSource` class or by providing your own data loading logic.
You can create custom content origins by extending the `ContentOriginRegistration` class or by providing your own data loading logic.

```typescript
import { DataSource } from '@mitre-attack/attack-data-model';

class CustomDataSource extends DataSource {
class CustomContentOrigin extends ContentOriginRegistration {
// Implement custom data loading logic
}

const customDataSource = new CustomDataSource({
const customContentOrigin = new CustomContentOrigin({
source: 'custom',
// ... other options
});
Expand Down
Loading
Loading