# mitre/saf architecture

> Architecture diagram of the GitHub repository mitre/saf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mitre/saf
- Repository: https://github.com/mitre/saf

## Overview

SAF CLI is a security-automation command-line product centered on transforming security-tool reports into OHDF/HDF, then viewing, validating, supplementing, generating, or attesting to that data. Users invoke command families through the CLI; conversion dispatches to format-specific handlers, while eMASSer commands configure and operate a separate API workflow. The graph preserves README-documented capabilities whose implementations were not sampled. Relationships are limited to README statements and source-index references or excerpts; unsampled command internals are not inferred.

Main entry points: [`src/commands/view/summary.ts`](https://github.com/mitre/saf/blob/main/src/commands/view/summary.ts) (Summary Command), [`src/commands/convert/index.ts`](https://github.com/mitre/saf/blob/main/src/commands/convert/index.ts) (Format Conversion), [`src/commands/emasser`](https://github.com/mitre/saf/tree/main/src/commands/emasser) (eMASSer Commands), [`src/utils/emasser/api_connection.ts`](https://github.com/mitre/saf/blob/main/src/utils/emasser/api_connection.ts) (API Connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI Entry"]
  node_entry["Command Runtime<br/>[index.ts]"]
end

subgraph group_hdf["HDF Workflows"]
  node_conversion["Format Conversion<br/>[index.ts]"]
  node_asff["ASFF Import<br/>[asff2hdf.ts]"]
  node_other_converters["Other Converters"]
  node_attest["Attestations"]
  node_supplement["HDF Supplement"]
end

subgraph group_reports["Reports And Generation"]
  node_view["HDF Views"]
  node_summary["Summary Command<br/>[summary.ts]"]
  node_hdf_loader["HDF Data Loader<br/>[data_loader.ts]"]
  node_calculations["Summary Calculations<br/>[calculations.ts]"]
  node_output["Summary Output"]
  node_generate["Report Generation"]
  node_delta["Delta Generation<br/>[delta.ts]"]
  node_delta_matching["Control Matching<br/>[delta_matching.ts]"]
  node_threshold["Threshold Validation<br/>[threshold.ts]"]
end

subgraph group_emass["eMASSer Client"]
  node_emass_commands["eMASSer Commands"]
  node_dashboards["Dashboard Queries<br/>[dashboards.ts]"]
  node_poam_update["POA&amp;M Updates<br/>[poams.ts]"]
  node_api_connection["API Connection<br/>[api_connection.ts]"]
end

subgraph group_shared["Shared Runtime"]
  node_global["Shared Utilities<br/>[global.ts]"]
  node_base_command["CLI Command Base<br/>[base_command.ts]"]
  node_logging["Logging<br/>[logging.ts]"]
end

node_user(("CLI User"))
node_emass_api{{"eMASS API"}}

node_user -->|"runs commands"| node_entry
node_entry -.->|"dispatches convert"| node_conversion
node_conversion -->|"dispatches ASFF"| node_asff
node_conversion -->|"dispatches formats"| node_other_converters
node_user -->|"requests attestations"| node_attest
node_user -->|"requests supplement"| node_supplement
node_user -->|"requests views"| node_view
node_view -->|"offers summary"| node_summary
node_summary -->|"loads HDF"| node_hdf_loader
node_summary -->|"calculates summaries"| node_calculations
node_summary -->|"generates output"| node_output
node_user -->|"requests generation"| node_generate
node_generate -->|"offers delta"| node_delta
node_delta -->|"matches controls"| node_delta_matching
node_user -->|"validates thresholds"| node_threshold
node_user -->|"runs API commands"| node_emass_commands
node_emass_commands -->|"queries dashboards"| node_dashboards
node_emass_commands -->|"updates POA&amp;Ms"| node_poam_update
node_dashboards -->|"creates connection"| node_api_connection
node_poam_update -->|"creates connection"| node_api_connection
node_api_connection -->|"configures access"| node_emass_api
node_asff -->|"uses utilities"| node_global
node_summary -->|"logs activity"| node_logging

click node_entry "https://github.com/mitre/saf/blob/main/src/index.ts"
click node_conversion "https://github.com/mitre/saf/blob/main/src/commands/convert/index.ts"
click node_asff "https://github.com/mitre/saf/blob/main/src/commands/convert/asff2hdf.ts"
click node_other_converters "https://github.com/mitre/saf/tree/main/src/commands/convert"
click node_attest "https://github.com/mitre/saf/tree/main/src/commands/attest"
click node_supplement "https://github.com/mitre/saf/tree/main/src/commands/supplement"
click node_view "https://github.com/mitre/saf/tree/main/src/commands/view"
click node_summary "https://github.com/mitre/saf/blob/main/src/commands/view/summary.ts"
click node_hdf_loader "https://github.com/mitre/saf/blob/main/src/utils/ohdf/data_loader.ts"
click node_calculations "https://github.com/mitre/saf/blob/main/src/utils/ohdf/calculations.ts"
click node_output "https://github.com/mitre/saf/blob/main/src/utils/ohdf/output_generator.ts"
click node_generate "https://github.com/mitre/saf/tree/main/src/commands/generate"
click node_delta "https://github.com/mitre/saf/blob/main/src/commands/generate/delta.ts"
click node_delta_matching "https://github.com/mitre/saf/blob/main/src/utils/delta_matching.ts"
click node_threshold "https://github.com/mitre/saf/blob/main/src/commands/validate/threshold.ts"
click node_emass_commands "https://github.com/mitre/saf/tree/main/src/commands/emasser"
click node_dashboards "https://github.com/mitre/saf/blob/main/src/commands/emasser/get/dashboards.ts"
click node_poam_update "https://github.com/mitre/saf/blob/main/src/commands/emasser/put/poams.ts"
click node_api_connection "https://github.com/mitre/saf/blob/main/src/utils/emasser/api_connection.ts"
click node_global "https://github.com/mitre/saf/blob/main/src/utils/global.ts"
click node_base_command "https://github.com/mitre/saf/blob/main/src/utils/oclif/base_command.ts"
click node_logging "https://github.com/mitre/saf/blob/main/src/utils/logging.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_user toneBlue
class node_conversion,node_asff,node_other_converters,node_attest,node_supplement toneAmber
class node_view,node_summary,node_hdf_loader,node_calculations,node_output,node_generate,node_delta,node_delta_matching,node_threshold,node_emass_api toneMint
class node_emass_commands,node_dashboards,node_poam_update,node_api_connection toneRose
class node_global,node_base_command,node_logging toneIndigo
```

## Components

### CLI Entry

- [Command Runtime](https://github.com/mitre/saf/blob/main/src/index.ts): `src/index.ts`

### HDF Workflows

- [Format Conversion](https://github.com/mitre/saf/blob/main/src/commands/convert/index.ts): `src/commands/convert/index.ts`
- [ASFF Import](https://github.com/mitre/saf/blob/main/src/commands/convert/asff2hdf.ts): `src/commands/convert/asff2hdf.ts`
- [Other Converters](https://github.com/mitre/saf/tree/main/src/commands/convert): `src/commands/convert`
- [Attestations](https://github.com/mitre/saf/tree/main/src/commands/attest): `src/commands/attest`
- [HDF Supplement](https://github.com/mitre/saf/tree/main/src/commands/supplement): `src/commands/supplement`

### Reports And Generation

- [HDF Views](https://github.com/mitre/saf/tree/main/src/commands/view): `src/commands/view`
- [Summary Command](https://github.com/mitre/saf/blob/main/src/commands/view/summary.ts): `src/commands/view/summary.ts`
- [HDF Data Loader](https://github.com/mitre/saf/blob/main/src/utils/ohdf/data_loader.ts): `src/utils/ohdf/data_loader.ts`
- [Summary Calculations](https://github.com/mitre/saf/blob/main/src/utils/ohdf/calculations.ts): `src/utils/ohdf/calculations.ts`
- [Summary Output](https://github.com/mitre/saf/blob/main/src/utils/ohdf/output_generator.ts): `src/utils/ohdf/output_generator.ts`
- [Report Generation](https://github.com/mitre/saf/tree/main/src/commands/generate): `src/commands/generate`
- [Delta Generation](https://github.com/mitre/saf/blob/main/src/commands/generate/delta.ts): `src/commands/generate/delta.ts`
- [Control Matching](https://github.com/mitre/saf/blob/main/src/utils/delta_matching.ts): `src/utils/delta_matching.ts`
- [Threshold Validation](https://github.com/mitre/saf/blob/main/src/commands/validate/threshold.ts): `src/commands/validate/threshold.ts`

### eMASSer Client

- [eMASSer Commands](https://github.com/mitre/saf/tree/main/src/commands/emasser): `src/commands/emasser`
- [Dashboard Queries](https://github.com/mitre/saf/blob/main/src/commands/emasser/get/dashboards.ts): `src/commands/emasser/get/dashboards.ts`
- [POA&M Updates](https://github.com/mitre/saf/blob/main/src/commands/emasser/put/poams.ts): `src/commands/emasser/put/poams.ts`
- [API Connection](https://github.com/mitre/saf/blob/main/src/utils/emasser/api_connection.ts): `src/utils/emasser/api_connection.ts`

### Shared Runtime

- [Shared Utilities](https://github.com/mitre/saf/blob/main/src/utils/global.ts): `src/utils/global.ts`
- [CLI Command Base](https://github.com/mitre/saf/blob/main/src/utils/oclif/base_command.ts): `src/utils/oclif/base_command.ts`
- [Logging](https://github.com/mitre/saf/blob/main/src/utils/logging.ts): `src/utils/logging.ts`

### Other components

- **CLI User**
- **eMASS API**

## Connections

- CLI User → Command Runtime: runs commands (evidence: `README.md`)
- Command Runtime → Format Conversion: dispatches convert
- Format Conversion → ASFF Import: dispatches ASFF (evidence: `src/commands/convert/index.ts`)
- Format Conversion → Other Converters: dispatches formats (evidence: `README.md`)
- CLI User → Attestations: requests attestations (evidence: `README.md`)
- CLI User → HDF Supplement: requests supplement (evidence: `README.md`)
- CLI User → HDF Views: requests views (evidence: `README.md`)
- HDF Views → Summary Command: offers summary (evidence: `README.md`)
- Summary Command → HDF Data Loader: loads HDF (evidence: `src/commands/view/summary.ts`)
- Summary Command → Summary Calculations: calculates summaries (evidence: `src/commands/view/summary.ts`)
- Summary Command → Summary Output: generates output (evidence: `src/commands/view/summary.ts`)
- CLI User → Report Generation: requests generation (evidence: `README.md`)
- Report Generation → Delta Generation: offers delta (evidence: `README.md`)
- Delta Generation → Control Matching: matches controls (evidence: `src/commands/generate/delta.ts`)
- CLI User → Threshold Validation: validates thresholds (evidence: `README.md`)
- CLI User → eMASSer Commands: runs API commands (evidence: `README.md`)
- eMASSer Commands → Dashboard Queries: queries dashboards (evidence: `README.md`)
- eMASSer Commands → POA&M Updates: updates POA&Ms (evidence: `README.md`)
- Dashboard Queries → API Connection: creates connection (evidence: `src/commands/emasser/get/dashboards.ts`)
- POA&M Updates → API Connection: creates connection (evidence: `src/commands/emasser/put/poams.ts`)
- API Connection → eMASS API: configures access (evidence: `src/utils/emasser/api_connection.ts`)
- ASFF Import → Shared Utilities: uses utilities (evidence: `src/commands/convert/asff2hdf.ts`)
- Summary Command → Logging: logs activity (evidence: `src/commands/view/summary.ts`)
