Skip to content

@mitre/hdf-converters ​

Convert security tool outputs to and from Heimdall Data Format (HDF). Part of the hdf-libs monorepo.

Every converter is implemented in both TypeScript and Go. The TypeScript library is published as an npm package; the Go implementations are used by the hdf CLI.

All converter output conforms to the HDF JSON Schema.

Supported Converters ​

Security Tool to HDF ​

Source FormatFunctionInput
ASFF (AWS Security Finding Format)convertAsffToHdfJSON
AWS ConfigconvertAwsConfigToHdfJSON
BurpSuiteconvertBurpsuiteToHdfXML
CheckovconvertCheckovToHdfJSON
CKL (DISA STIG Viewer checklist)convertCklToHdfXML
CKLB (DISA STIG Viewer 3.x checklist)convertCklbToHdfJSON
ConveyorconvertConveyorToHdfJSON
CSAF VEX (→ HDF Amendments)convertCsafVexToHdfJSON
CycloneDX (SBOM)convertCyclonedxToHdfJSON
CycloneDX VEX (→ HDF Amendments)convertCyclonedxVexToHdfJSON
DBProtectconvertDbprotectToHdfXML
DefectDojoconvertDefectDojoToHdfJSON
Dependency-TrackconvertDeptrackToHdfJSON
FortifyconvertFortifyToHdfXML
GitLab Security ReportconvertGitlabToHdfJSON
GosecconvertGosecToHdfJSON
GrypeconvertGrypeToHdfJSON
HipcheckconvertHipcheckToHdfJSON
Ion ChannelconvertIonchannelToHdfJSON
JFrog XrayconvertJfrogXrayToHdfJSON
JUnitconvertJunitToHdfXML
KICSconvertKicsToHdfJSON
MSFT Defender for CloudconvertMsftDefenderCloudToHdfJSON
MSFT Defender for DevOpsconvertMsftDefenderDevopsToHdfJSON
MSFT Defender for EndpointconvertMsftDefenderEndpointToHdfJSON
MSFT Secure ScoreconvertMsftSecureScoreToHdfJSON
NessusconvertNessusToHdfXML
Netsparker / InvicticonvertNetsparkerToHdfXML
NeuVectorconvertNeuvectorToHdfJSON
NiktoconvertNiktoToHdfJSON
OpenVEX (→ HDF Amendments)convertOpenVexToHdfJSON
OSCAL CatalogconvertOscalCatalogToHdfJSON
OSCAL Component DefinitionconvertOscalComponentToHdfJSON
OSCAL POA&MconvertOscalPoamToHdfJSON
OSCAL ProfileconvertOscalProfileToHdfJSON
OSCAL SAPconvertOscalSapToHdfJSON
OSCAL SARconvertOscalSarToHdfJSON
OSCAL SSPconvertOscalSspToHdfJSON
OWASP ZAPconvertZapToHdfJSON
Prisma CloudconvertPrismaToHdfJSON
SARIFconvertSarifToHdfJSON
ScoutSuiteconvertScoutsuiteToHdfJSON
SemgrepconvertSemgrepToHdfJSON (native; SARIF auto-routed)
SnykconvertSnykToHdfJSON
SonarQubeconvertSonarqubeToHdfJSON
SPDX VEX (SPDX 3.0 security profile → HDF Amendments)convertSpdxVexToHdfJSON
SplunkconvertSplunkToHdfJSON
TrivyconvertTrivyToHdfJSON (native; SARIF/CycloneDX/ASFF/GitLab auto-routed)
TruffleHogconvertTrufflehogToHdfJSON
TwistlockconvertTwistlockToHdfJSON
VeracodeconvertVeracodeToHdfXML
XCCDF ResultsconvertXccdfResultsToHdfXML

HDF to Other Formats ​

Target FormatFunction
CSVconvertHdfToCsv
ECS (Elastic Common Schema 9.4.0 NDJSON)convertHdfToEcs
Splunk (CIM Vulnerabilities / HEC NDJSON)convertHdfToSplunk
OCSF (v1.8.0 Compliance / Vulnerability Finding NDJSON)convertHdfToOcsf
ASFF (AWS Security Finding Format {"Findings":[...]} envelope)convertHdfToAsff
XMLconvertHdfToXml
XCCDFconvertHdfToXccdf
CKL (DISA STIG Viewer checklist)convertHdfToCkl
CKLB (DISA STIG Viewer 3.x checklist)convertHdfToCklb
OSCAL SARconvertHdfToOscalSar
OSCAL POA&MconvertHdfToOscalPoam
CSAF VEX (HDF Amendments → advisory, partial-fidelity)convertHdfToCsafVex
OpenVEX (HDF Amendments → statements, partial-fidelity)convertHdfToOpenVex
CycloneDX VEX (HDF Amendments → BOM, partial-fidelity)convertHdfToCyclonedxVex

Format Migration ​

ConversionFunction
Legacy HDF (InSpec exec-json format) to current HDFconvertV1ToV2
Detect legacy HDF formatisHDFV1

Enrichment ​

Enrichment overlays external context onto an existing HDF results document as inert externalReferences[] (matched to findings by CVE, else the results root). It is informational — it never changes a finding's status or impact — and is distinct from a converter (it takes a results doc plus a source, and returns the enriched results doc).

SourceFunctionFormat
STIX 2.1 bundle → results externalReferences[]enrichStixJSON
Detect / parse a STIX 2.1 bundledetectStixBundle / parseStixBundleJSON

CLI: hdf enrich <results> <source> (see the hdf-cli README).

Installation ​

bash
npm install @mitre/hdf-converters@next   # newest v3 stable
npm install @mitre/hdf-converters@3.5.1  # pin an exact version

This package's npm name is shared with heimdall2, which publishes the v2 line and owns the latest dist-tag — a plain npm install @mitre/hdf-converters installs v2, not this library. Always install the v3 line via @next or an exact version (npm does not permit a v3 dist-tag — tag names may not be valid semver ranges).

Requires Node.js >= 22.

TypeScript Usage ​

All exports use ESM ("type": "module").

Convert a security tool report ​

typescript
import { convertGrypeToHdf } from '@mitre/hdf-converters';

const grypeJson = fs.readFileSync('grype-report.json', 'utf-8');
const hdfResults = convertGrypeToHdf(grypeJson, 'grype-report.json');

Auto-detect input format ​

The @mitre/hdf-converters/detect sub-path provides lightweight format detection without importing any converter code.

typescript
import { registerAllFingerprints, detectConverter } from '@mitre/hdf-converters/detect';

registerAllFingerprints();
const result = detectConverter(rawInput);
// result.fingerprint.id  -> e.g. 'grype-to-hdf'
// result.confidence       -> 0.0 to 1.0
// result.version          -> detected format version (if available)

Upgrade legacy HDF ​

typescript
import { convertV1ToV2, isHDFV1 } from '@mitre/hdf-converters';

const data = JSON.parse(fileContent);
if (isHDFV1(data)) {
  const currentHdf = convertV1ToV2(data);
}

Go Usage ​

Go converters live under converters/<name>/go/ and follow the same function signature:

go
import grype "github.com/mitre/hdf-libs/hdf-converters/v3/converters/grype-to-hdf/go"

// converterVersion is the value stamped as generator.version in the output.
results, err := grype.ConvertGrypeToHDF(input, converterVersion)

The first argument is the raw tool output ([]byte); the second is the converter version string, not the source filename.

For CLI usage, install the hdf binary from hdf-cli:

bash
hdf convert grype-report.json -o results.json          # auto-detect format
hdf convert --from grype grype-report.json -o results.json  # explicit format

Package Exports ​

Import pathContents
@mitre/hdf-convertersAll converter functions and types
@mitre/hdf-converters/detectAuto-detection (fingerprints, detectConverter)
@mitre/hdf-converters/registryFingerprint registry primitives

Project Structure ​

hdf-converters/
  converters/<name>/
    typescript/converter.ts       # TS implementation
    typescript/converter.test.ts  # TS tests
    go/converter.go               # Go implementation
    go/converter_test.go          # Go tests
    fixtures/input/               # Real tool output
    fixtures/expected/            # Schema-validated expected HDF
  shared/
    typescript/                   # Shared TS helpers
    go/                           # Shared Go helpers
  src/
    index.ts                      # Barrel export (all converters)
    detect.ts                     # Auto-detection sub-path entry

Each converter has shared test fixtures and differential tests that verify TypeScript and Go produce identical output.

Adding a New Converter ​

See Writing a Converter for implementation instructions.

Summary:

  1. Add real tool output fixtures in converters/<name>/fixtures/input/
  2. Write tests first (TDD) in both TypeScript and Go
  3. Implement the converter in converters/<name>/typescript/ and converters/<name>/go/
  4. Register a fingerprint for auto-detection and add its blank-import to registry/all/all.go
  5. Register the converter in registry/convert/converter_<name>.go with an init() that calls registerHDFConverter, registerHDFBaselineConverter, registerHDFPlanConverter, or registerHDFAmendmentsConverter for its output type; the CLI and the MCP server share this registry, so only the integration test lives in hdf-cli/cmd/hdf/cmd/converter_<name>_test.go

License ​

Apache-2.0 -- MITRE Corporation

Released under the Apache 2.0 License.