This directory contains automation and validation scripts for development, testing, and release workflows.
| Script | Purpose | When to Use |
|---|---|---|
create_plugin.sh |
Generate YAML plugin templates | Adding new service plugins |
release.sh |
Automate release process | Creating new releases |
validate-cbom.sh |
Comprehensive CBOM validation | Testing generated output |
validate-schemas.sh |
CycloneDX schema validation | CI/CD, schema updates |
validate-normalization.sh |
Asset ID normalization tests | After normalization changes |
validate-property-mappings.sh |
Property mapping drift detection | Before releases |
check-orphan-code.sh |
Find unused source files | Code cleanup |
Purpose: Quickly generate YAML plugin templates for new service detectors.
# Usage
./scripts/create_plugin.sh <name> <category> <port> [process_name] [parser]
# Examples
./scripts/create_plugin.sh Tomcat application_server 8443 java apache
./scripts/create_plugin.sh Cassandra database 9042
./scripts/create_plugin.sh HAProxy load_balancer 443Arguments:
name- Service name (e.g., Tomcat, Cassandra)category- Category (database, web_server, mail_server, application_server, etc.)port- Primary TLS/SSL port numberprocess_name- (optional) Process name, defaults to lowercase nameparser- (optional) Config parser type, defaults toini
Output: Creates plugins/<name>.yaml with detection methods and config extraction template.
Next Steps After Creation:
- Edit the generated file to customize for actual service specifics
- Test loading:
./build/cbom-generator --plugin-dir plugins --list-plugins - Validate:
./tests/validate_plugin.sh plugins/<name>.yaml
Purpose: Find source files not included in build or tests (dead code detection).
./scripts/check-orphan-code.shWhat it checks:
.cfiles insrc/not referenced in CMakeLists.txt.hfiles ininclude/andsrc/not included anywhere- Test files in
tests/are excluded from orphan detection
Exit Codes:
0- No orphan files found1- Orphan files detected (lists them)
Use Case: Run before commits to ensure no dead code accumulates.
Purpose: Automate the complete release workflow.
./scripts/release.sh <version>
# Example
./scripts/release.sh 1.3.0What it does (10 steps):
- Verifies version in CMakeLists.txt
- Creates clean release build
- Verifies binary exists
- Runs test suite
- Validates all 50+ plugins
- Tests plugin loading
- Creates release artifacts (binary, tarball)
- Generates SHA-256 checksums
- Displays release summary
- Provides git tag instructions
Output:
release/
├── cbom-generator-<version>-linux-amd64.tar.gz
└── checksums.txt
Prerequisites:
- Version must match in CMakeLists.txt
- All tests must pass
- RELEASE_NOTES_.md must exist
Purpose: Comprehensive validation of generated CBOM files.
./scripts/validate-cbom.sh [cbom-file]
# Examples
./scripts/validate-cbom.sh cbom.json
./scripts/validate-cbom.sh # defaults to cbom-etc-1.7.cdx.jsonValidation Tests:
- JSON Syntax - Valid JSON parsing
- CycloneDX Structure - Required fields (bomFormat, specVersion, metadata, components)
- Component Inventory - Counts by type, crypto assets, dependencies
- Certificate Analysis - Certificate properties, CycloneDX 1.7 native fields
- Data Quality - Property value types, bom-ref uniqueness
- Official Validator - cyclonedx-cli (if installed)
Dependencies:
python3(required)cyclonedx-cli(optional, for official validation)
Install Official Validator:
npm install -g @cyclonedx/cyclonedx-cliPurpose: Validate pinned CycloneDX schemas haven't been modified.
./scripts/validate-schemas.shWhat it does:
- Checks if CycloneDX 1.6 schema exists in
tests/schemas/ - Validates SHA-256 checksum against pinned value
- Downloads schema if missing
- Verifies schema is valid JSON
Files:
tests/schemas/cyclonedx-1.6.schema.json- Pinned schematests/schemas/cyclonedx-1.6.schema.json.sha256- Checksum file
Use Case: CI/CD to ensure schema integrity, detect unauthorized modifications.
Purpose: Validate asset ID normalization rules haven't drifted.
./scripts/validate-normalization.shWhat it validates:
- Builds project if needed
- Runs normalization tests from
cbom-tests - Verifies
docs/NORMALIZATION.mdexists - Checks frozen test vector IDs in source code
Frozen Test Vectors:
The script verifies specific SHA-256 test vector IDs exist in src/normalization.c to detect backwards compatibility breaks.
When to Run: After any changes to normalization rules, before releases.
Purpose: Detect property mapping drift from FROZEN v1.0 specification.
./scripts/validate-property-mappings.shWhat it validates:
- Property Guide -
docs/CBOM_PROPERTY_GUIDE.mdexists, version 1.0, marked FROZEN - Source Code -
src/cyclonedx_converter.ccontains FROZEN marker - Component Type Mappings - 6 mappings verified:
ASSET_TYPE_ALGORITHM→CYCLONEDX_COMPONENT_LIBRARYASSET_TYPE_KEY→CYCLONEDX_COMPONENT_DATAASSET_TYPE_CERTIFICATE→CYCLONEDX_COMPONENT_DATAASSET_TYPE_LIBRARY→CYCLONEDX_COMPONENT_LIBRARYASSET_TYPE_PROTOCOL→CYCLONEDX_COMPONENT_LIBRARYASSET_TYPE_SERVICE→CYCLONEDX_COMPONENT_OPERATING_SYSTEM
- Property Namespaces - 7 namespaces verified (cbom:algo:, cbom:cert:, etc.)
- Required Property Counts - Stable counts for each asset type
- Forbidden Types - No application, framework, container, device, file, firmware
- CycloneDX Version - Pinned to 1.6
Exit Codes:
0- All validations passed1- Drift detected (details printed)
When to Run: Before every release, after CycloneDX converter changes.
# Example GitHub Actions workflow
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check orphan code
run: ./scripts/check-orphan-code.sh
- name: Validate schemas
run: ./scripts/validate-schemas.sh
- name: Build
run: cmake -B build && cmake --build build
- name: Validate normalization
run: ./scripts/validate-normalization.sh
- name: Validate property mappings
run: ./scripts/validate-property-mappings.sh
- name: Run tests
run: cd build && ctest
- name: Generate CBOM
run: ./build/cbom-generator -o test-cbom.json
- name: Validate CBOM
run: ./scripts/validate-cbom.sh test-cbom.jsonAdd to .git/hooks/pre-commit:
#!/bin/bash
./scripts/check-orphan-code.sh || exit 1
./scripts/validate-property-mappings.sh || exit 1Copyright © 2025 Graziano Labs Corp. All rights reserved.
