Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@mitre/hdf-generators

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mitre/hdf-generators

Generate InSpec profile stubs from HDF Baseline definitions

latest
Source
npmnpm
Version
3.2.0
Version published
Maintainers
2
Created
Source

@mitre/hdf-generators

Generate InSpec profile stubs from HDF Baseline definitions.

What it does

Takes an HDF Baseline JSON document (requirement definitions with metadata, descriptions, and tags) and generates a complete InSpec profile directory structure:

  • inspec.yml — profile metadata (name, maintainer, license, version, platform supports)
  • controls/*.rb — one control file per requirement with describe blocks, tags, and impact

This bridges from HDF's tool-agnostic baseline format to InSpec's executable compliance-as-code format.

Relationship to other packages

PackageRelationship
hdf-schemaProvides the HDFBaseline type that generators consume
hdf-convertersConverters produce baselines (e.g., XCCDF benchmark → HDF baseline) that generators can then turn into InSpec profiles
hdf-clihdf generate inspec-profile command wraps this library
hdf-mappingsBaselines may contain NIST/CCI tags from hdf-mappings

Installation

npm install @mitre/hdf-generators

Usage (TypeScript)

import { generateInSpecProfile } from '@mitre/hdf-generators';
import type { HDFBaseline } from '@mitre/hdf-schema';

const baseline: HDFBaseline = JSON.parse(fs.readFileSync('baseline.json', 'utf8'));

const profile = generateInSpecProfile(baseline, {
  maintainer: 'MITRE SAF',
  copyright: 'MITRE Corporation',
  license: 'Apache-2.0',
});

// profile.inspecYml — string content for inspec.yml
// profile.controls  — Map<string, string> of filename → Ruby control code

Individual stubs

import { generateControlStub, generateInSpecYml, escapeQuotes } from '@mitre/hdf-generators';

// Generate a single control file
const ruby = generateControlStub(requirement);

// Generate inspec.yml
const yml = generateInSpecYml(baseline, { maintainer: 'Team', license: 'Apache-2.0' });

Usage (Go)

import generators "github.com/mitre/hdf-generators"

profile := generators.GenerateInSpecProfile(baseline, generators.ProfileMetadata{
    Maintainer: "MITRE SAF",
    License:    "Apache-2.0",
})
// profile.InspecYml — string
// profile.Controls  — map[string]string

CLI usage

hdf generate inspec-profile baseline.json output-dir/
hdf generate inspec-profile baseline.json output-dir/ --maintainer "MITRE SAF"
hdf generate inspec-profile baseline.json output-dir/ --single-file

License

Apache-2.0 © MITRE Corporation

Keywords

hdf

FAQs

Package last updated on 26 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts