Skip to content

Legacy HDF Migration Guide ​

This guide is for tool authors and pipeline maintainers who work with Legacy HDF (InSpec exec-json) output and need to understand the changes in the current HDF format.

For full architecture details, see hdf-document-ecosystem.md.

Audience ​

  • Teams maintaining InSpec-based security scanning pipelines
  • Developers integrating with Heimdall or the HDF CLI
  • Tool authors consuming or producing HDF documents

Key Renames ​

Legacy HDF (InSpec exec-json)HDF (current)Notes
profiles[]baselines[]Terminology alignment -- "baseline" is tool-agnostic, "profile" is InSpec-specific
controls[]requirements[]Broader scope: security requirements, not just InSpec controls
attributes[]inputs[]InSpec v4/v5 rename; now typed with Input primitive
platform (object)components[] (array)Polymorphic, supports multiple components of different types
code_desccodeDesccamelCase normalization
source_locationsourceLocationcamelCase normalization
start_timestartTimecamelCase normalization; values normalized to ISO 8601
run_timerunTimecamelCase normalization
status "skipped""notReviewed"SARIF-compatible terminology: the requirement was not assessed
sha256 (string)checksum (object)Structured: { "algorithm": "sha256", "value": "..." }
desc (string)descriptions[] (array)Array of labeled descriptions with { "label": "default", "data": "..." }

Structural Changes in Detail ​

profiles to baselines ​

v1:

json
{
  "profiles": [
    { "name": "rhel9-stig", "controls": [...] }
  ]
}

v2:

json
{
  "baselines": [
    { "name": "rhel9-stig", "requirements": [...] }
  ]
}

The baselines array is the only required top-level field in hdf-results.

platform to components ​

v1 has a single platform object:

json
{
  "platform": { "name": "ubuntu", "release": "22.04", "target_id": "" }
}

v2 has an array of polymorphic components, each with a type discriminator:

json
{
  "components": [
    {
      "type": "host",
      "name": "web-server-01",
      "osName": "Ubuntu",
      "osVersion": "22.04 LTS",
      "labels": { "component": "WebTier", "environment": "production" }
    }
  ]
}

Supported component types: host, containerImage, containerInstance, containerPlatform, cloudAccount, cloudResource, repository, application, artifact, network, database, aiModel, dataset.

attributes to inputs (typed) ​

v1 attributes are unstructured maps:

json
{
  "attributes": [
    { "name": "max_sessions", "options": { "default": 3 } }
  ]
}

v2 inputs use the typed Input primitive:

json
{
  "inputs": [
    {
      "name": "max_sessions",
      "type": "Numeric",
      "value": 3,
      "description": "Maximum concurrent sessions per user",
      "required": true,
      "operator": "le",
      "constraints": { "min": 1, "max": 100 }
    }
  ]
}

Supported input types: String, Numeric, Boolean, Array, Hash, Regexp.

sha256 to checksum ​

v1:

json
{ "sha256": "abc123def456..." }

v2:

json
{
  "checksum": {
    "algorithm": "sha256",
    "value": "abc123def456..."
  }
}

The Checksum object supports multiple algorithms and is used across document types for integrity verification.

Status normalization ​

v1 "skipped" maps to v2 "notReviewed". The complete v2 Result_Status enum is:

  • passed -- requirement met
  • failed -- requirement not met
  • error -- test execution error
  • notApplicable -- requirement does not apply to this target
  • notReviewed -- requirement was not assessed

v2 also adds effectiveStatus on each requirement, which carries the status the canonical effective-status ladder computes at write time: a governing (non-expired) override, else the worst-wins roll-up (error > failed > passed > notApplicable > notReviewed). Impact is not consulted — an impact of 0 is a severity band, not a statement that the requirement does not apply. See the status determination reference for the full contract.

InSpec says "this control does not apply" by scoring the control 0 and then reporting no pass or fail for it. Because the ladder does not read impact, this importer records that verdict where every consumer can see it: a control scored 0 whose results establish nothing gains an explicit notApplicable result, alongside the skip the runner recorded. The control's impact is left at 0 — that is a fact about the source — and tags.severity still carries the original STIG severity where a profile zeroed it.

A document converted before this behaviour landed carries impact 0 with a notReviewed roll-up and no translated result, so recomputing its status now reports notReviewed where the stored effectiveStatus says notApplicable. Re-converting from the original source settles both.

Severity ​

v2 adds an explicit severity field on requirements: critical, high, medium, low, informational. This is derived from tags.severity when present (preserving original STIG severity), falling back to impact-derived severity:

ImpactSeverity
>= 0.9critical
>= 0.7high
>= 0.5medium
> 0low
0informational

New v2 Features Not in v1 ​

These fields and concepts are new in v2 and have no v1 equivalent:

  • Labels -- Record<string, string> on components and baselines for flexible grouping by system, component, environment, region, team, or custom dimensions.
  • Typed inputs -- Input primitive with type, operator, and constraints. Bridges governance requirements to scanner automation.
  • systemRef / planRef -- URI references linking results to hdf-system and hdf-plan documents, establishing provenance.
  • Multiple component types -- 13 polymorphic component types (host, container image, container instance, container platform, cloud account, cloud resource, repository, application, artifact, network, database, AI model, dataset).
  • hdf-system documents -- Describe system architecture, authorization boundaries, components with label-based selectors, input overrides, and SBOM references.
  • hdf-plan documents -- Assessment plans with resolved inputs, target selectors, runner configuration, and schedules.
  • hdf-amendments documents -- Standalone signed waivers, attestations, and POA&Ms that merge into results.
  • hdf-evidence-package documents -- Audit-ready bundles referencing all other document types with completeness checks and integrity verification.
  • hdf-comparison documents -- Structured diffs between any two HDF documents of the same type.

How to Convert ​

CLI ​

bash
hdf convert --from legacyhdf old-results.json -o new-results.json

The inspec alias also works:

bash
hdf convert --from inspec old-results.json -o new-results.json

The converter reads from stdin if the input is -:

bash
cat old-results.json | hdf convert --from legacyhdf - -o new-results.json

Programmatic (Go) ​

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

// ParseLegacyHDF applies the size guard and format check, then decodes the input.
v1, err := legacyhdf.ParseLegacyHDF(input)
if err != nil {
    return err
}
// The second argument is the generator version recorded in the output ("" uses the default).
current := legacyhdf.ConvertLegacyHDF(v1, "")

The Go converter performs a comprehensive transformation:

  • profiles to baselines, controls to requirements
  • attributes to typed inputs (extracting name, value, description, sensitive, required, type from the v1 map)
  • sha256 to checksum object
  • snake_case to camelCase on all fields
  • "skipped" to "notReviewed"
  • platform to a components[] array with a single host component
  • Computes effectiveStatus and severity for every requirement
  • Flattens overlay/wrapper baselines to eliminate duplicate controls

Programmatic (TypeScript) ​

The hdf-diff normalizer handles v1 transparently for diffing purposes:

typescript
import { isV1Format, normalizeToV2 } from '@mitre/hdf-diff/normalize';

if (isV1Format(doc)) {
  const v2 = normalizeToV2(doc);
  // v2 has baselines[], requirements[], camelCase fields
}

The normalizer detects v1 by checking for profiles at the top level (v2 uses baselines). It converts:

  • profiles[].controls[] to baselines[].requirements[]
  • sha256 to { algorithm: "sha256", value: "..." }
  • attributes to inputs
  • source_location to sourceLocation
  • code_desc to codeDesc, start_time to startTime, run_time to runTime
  • "skipped" to "notReviewed"
  • Timestamps are normalized to ISO 8601

You can diff v1 and v2 documents directly -- the diff engine normalizes v1 on the fly:

bash
hdf diff v1-results.json v2-results.json

Common Pitfalls ​

attributes and inputs are different structures ​

Do not write both attributes and inputs on the same baseline. v2 uses only inputs. If you are producing v2 output, use the Input type with name (required) and optional type, value, description, required, sensitive, operator, constraints.

v1 attributes used options.default for the value:

json
{ "name": "x", "options": { "default": 3 } }

v2 inputs use a top-level value field:

json
{ "name": "x", "type": "Numeric", "value": 3 }

platform is an object, components is an array ​

v1 platform is a single object. v2 components is an array of objects, each with a required type discriminator. If you are constructing v2 output from v1 data, wrap the platform in an array and set type: "host":

json
{
  "components": [
    { "type": "host", "name": "ubuntu" }
  ]
}

controls is not an array of strings ​

In v1 groups, controls is an array of control ID strings. In v2, the group field is renamed to requirements (also an array of requirement ID strings). But requirements at the baseline level is an array of EvaluatedRequirement objects. Do not confuse the two.

Overlay flattening ​

v1 InSpec output often contains overlay/wrapper profiles where a parent profile includes controls from a child profile, resulting in duplicate controls across profiles[]. The v1-to-v2 converter flattens these overlays into one requirement per id with a result per layer that evaluated it, so no layer's verdict is dropped. If you are writing your own converter, roll layers up the same way rather than keeping one entry and discarding the rest; a repeated id is legal HDF (see the specification's Requirement identity convention), so a consumer must cope with it either way.

Timestamps ​

v1 uses formats like "2017-09-22 14:12:15 -0400" which are not valid ISO 8601. v2 requires ISO 8601 / RFC 3339 format ("2017-09-22T18:12:15.000Z"). The converter normalizes timestamps automatically. If you are producing v2 output directly, use ISO 8601.

Risk adjustments in older amendments and OSCAL exports ​

Starting with hdf-libs v3.8.0, a riskAdjustment changes impact only and cannot carry status. This applies to standalone amendments and overrides already embedded in results.

It also affects reimporting older OSCAL POA&M exports. If a risk carries the HDF vocabulary properties override-type=riskAdjustment and override-status, the importer preserves both values, and the CLI rejects the resulting HDF amendments during output validation. A document exported before this tightening can therefore fail on reimport even though its OSCAL structure is valid.

Review the original decision before migrating it. If it changes compliance status, re-author the source amendment as the appropriate waiver or falsePositive, with the intended status. If it only changes impact, intentionally remove the status and retain the impact adjustment. Validate the revised amendment and export a new OSCAL POA&M; retain the original artifact for its audit history. Do not silently discard the status during import or bypass output validation to accept the old combination.

For override semantics, see Amendments.

Status ladder and threshold bucket in v3.8.0 ​

Starting with hdf-libs v3.8.0, an impact of 0 is a severity band and nothing more. The effective-status ladder consults a governing non-expired override, else the worst-wins roll-up of the results, and never impact; computeEffectiveStatus in @mitre/hdf-schema/helpers, both engines, hdf validate threshold and the MCP all follow it. The InSpec convention that a control scored 0 with no pass or fail is not applicable is translated at import, as the Status normalization section above describes: legacyhdf-to-hdf and splunk-to-hdf write an explicit notApplicable result for such a control.

What this changes for documents you already have:

  • A results document an older binary converted from InSpec output carries impact 0, a notReviewed roll-up and no translated result. Recomputed under the new ladder it reports notReviewed, while its stored effectiveStatus still says notApplicable. Re-convert from the original exec JSON; nothing we ship rewrites an existing document.
  • A document from a converter that derives impact through the shared severity map was never saying "not applicable" with impact 0. For those, clean scans now report passed where they reported notApplicable, and the change is a correction.
  • Effective checksums hash the resolved status, so a requirement-change-event chain anchored on an affected requirement reports chainGap afterwards. Re-derive the chain from a fresh rescan.
  • Several converters now state the status their source established instead of leaning on the impact-0 rule: xccdf-results-to-hdf maps notselected and informational to notApplicable with impact kept, grype-to-hdf maps an ignore-rule match to notApplicable, ionchannel-to-hdf states notApplicable on inventory records, msft-secure-score-to-hdf reports notReviewed for an unscored control, and asff-to-hdf carries a suppression as a waiver override. A compliance figure or threshold computed from these inputs moves accordingly; a SCAP threshold that pinned a deselected rule under skipped.informational now finds it under not_applicable.<severity>.

The threshold and compliance bucket for the notApplicable status is written not_applicable. no_impact, the SAF CLI spelling, is read permanently, in files and inline specs, and a spec that sets both is refused. Three surfaces this tool writes use the new key: templates from hdf generate threshold, the counts object in the hdf_compliance and hdf_aggregate MCP envelopes, and engine.statusCounts in the MCP contract. Update any jq pipeline or dashboard keyed on no_impact there. In Go, hdfengine.StatusCounts.NoImpact is renamed NotApplicable; in TypeScript, StatusCounts.noImpact is notApplicable. A threshold file this tool generates is accepted by saf validate threshold but its not_applicable bounds are silently ignored there; rewrite that section as no_impact before handing the file to SAF.

Released under the Apache 2.0 License.