Skip to main content

C/C++ SBOMs

tip

The most straightforward way to generate C/C++ SBOMs with RunSafe is by connecting your projects to the RunSafe Platform. This documentation exists for the cases when that is not possible.

License Acquisition

New Account Creation

Create an account through the RunSafe Platform and login. You will be prompted to create an organization. This is necessary to do before a license key is issued.

Where To Find the License Key

After creating an account on the RunSafe Platform, visit the License Key page to view your organization's license key. Save the key for future use.

Offline License Verification

Contact support@runsafesecurity.com for the necessary license files.

Further details on running in an offline environment can be found in the Retrieving Offline License Files section.

Package Preparation

RunSafe Security will provide you with packages for your operating system. If you do not have those files, contact support@runsafesecurity.com.

Linux

Locate the provided package and install through the system installer.

Redhat-based systems:

sudo rpm -i runsafe-sbom-<ver>.<arch>.rpm

Debian-based systems:

sudo dpkg -i runsafe-sbom-<ver>.<arch>.deb

The only dependency requirement is a GLIBC v2.17 or newer.

Windows

Locate the provided package runsafe_sbom_<ver>.zip and unpack to a temporary location. Further installation will be handled during the Initialization section.

Initialization

If running in an offline environment, refer to the Retrieving Offline License Files section.

The following sub-sections assume an unattended environment that would best mimic a pipeline integration.

Linux

Export the license key retrieved during the License Acquisition section, and leverage the installed runsafe_sbom executable to configure the environment.

export RUNSAFE_LICENSE_KEY=<acquired_key>
runsafe_sbom init -y

This will handle

  1. preparing the current terminal environment for initialization, and
  2. starting the RunSafe SBOM service for SBOM data handling.

For a full list of runsafe_sbom init options, see the Commandline Arguments appendix section.

Windows

Export the license key retrieved during the License Acquisition section, and leverage the installed runsafe_sbom executable to configure the environment. This must be done in the unpacked runsafe_sbom_<ver> directory.

cd runsafe_sbom_<ver>
set RUNSAFE_LICENSE_KEY=<acquired_key>
.\bin\runsafe_sbom.exe init -y

This will handle

  1. copying all necessary program files into your %LOCALAPPDATA% directory, and
  2. starting the RunSafe SBOM service for SBOM data handling.

For a full list of runsafe_sbom init options, see the Commandline Arguments appendix section.

Usage

RunSafe SBOM usage relies on the installed runsafe_sbom binary. For a full list of runsafe_sbom options, see the Commandline Arguments appendix section.

Note: In a Windows environment, the runsafe_sbom binary will not automatically be added to the %PATH%. You can do this manually in your working command prompt environment. The changes will not be permanent system-wide.

set PATH=%PATH%;%LOCALAPPDATA%\RunSafe\bin

RunSafe SBOM Service

The RunSafe SBOM service is started during the Initialization section and is used for data collection and enrichment. Verify the service is running.

runsafe_sbom service status

In some cases, especially when using a custom configuration files, it is helpful to see a more detailed status view. To see a more detailed view, including the running service configuration, add the --verbose flag.

runsafe_sbom service status --verbose

Build Integration

To build with the RunSafe SBOM Generation Tool enabled, prefix the build command with the runsafe_sbom wrapper command.

runsafe_sbom -- make -j4

Post-processing

Post-processing is required to format and enrich the generated data into a CycloneDX v1.6 SBOM. SBOMs can be selected through the SBOM ID and Audit ID or by defaulting to the most recently generated SBOM. SBOMs can be selected as either the most recently generated data, or through unique indentifiers specificied per SBOM.

To view the current SBOM(s) ready for post-processing and see their unique identifiers, use

runsafe_sbom report

The easiest way to post-process an SBOM is by selecting the most most recently generated data.

runsafe_sbom generate --most-recent \
--output-file=<path/to/desired/output/file>

In cases where relying on the most recently generated data isn't feasible, post-process using the IDs found above.

runsafe_sbom generate --sbom-id=<sbom_id> --audit-id=<audit_id> \
--output-file=<path/to/desired/output/file>

There will be a generated CycloneDX 1.6 SBOM at the specified output file.

NOTE This will check your license. If it fails to validate your license, refer to the Troubleshooting section on License Validation.

Configuration File

Some data may be manually overridden through the use of a configuration file.

File Location

Linux

The configuration file on any supported Linux system will be located at /usr/share/runsafe/config.toml.

An example configuration file can also be found at /usr/share/runsafe/example-config.toml.

Windows

The configuration file on a Windows system will be located at %LOCALAPPDATA%\RunSafe\config.toml.

An example configuration file can also be found at %LOCALAPPDATA%\RunSafe\example-config.toml.

Edit the Configuration File

Open the appropriate config.toml as specified in the File Location section using your favorite text editor and update as desired.

A full list of configuration file options is located in the Configuration File Settings section of the appendix.

Validate the Configuration File

It is recommended to validate the configuration file after any changes are made to prevent any errors when the service is restarted.

runsafe_sbom config validate

For a full list of runsafe_sbom config options, see the Commandline Arguments appendix section.

Load the Configuration File

After configuration file changes have been validated, it is necessary to restart the service to apply the changes. Note: In a Windows environment, this will need to be done in a privileged command prompt.

runsafe_sbom service stop
runsafe_sbom service start

Verify the new configuration profile is recognized by the service.

runsafe_sbom service status --verbose

For a full list of runsafe_sbom service options, see the Commandline Arguments appendix section.

Appendix

Retrieving Offline License Files

When running in a disconnected environment, it is necessary to acquire offline license files as there will be no connection to the RunSafe license server.

Contact support@runsafesecurity.com for the necessary license files. There will be two files provided:

  1. runsafe.res and
  2. runsafe.sig.

Linux

Place the license files in the /usr/share/runsafe/license directory, and configure the environment as normal.

runsafe_sbom init

Windows

Place the license files in the %LOCALAPPDATA%\RunSafe\license directory, and configure the environment as normal in a privileged command prompt.

cd runsafe_sbom_<ver>
.\bin\runsafe_sbom.exe init -y

Troubleshooting

For all questions not answered in this section, please contact support@runsafesecurity.com for further assistance.

Logging

Logging can be enabled through the use of the RUNSAFE_SBOM_LOG_LEVEL environment variable.

export RUNSAFE_SBOM_LOG_LEVEL=<log_level>

Supported log levels include: error, warn, debug, info.

By default, logs are reported to stdout. Logs can optionally be directed to a file by enabling the RUNSAFE_SBOM_FILE_LOGGER environment variable.

export RUNSAFE_SBOM_FILE_LOGGER=true

On a Linux system, logs are located at /tmp/runsafe/logs/.

In Windows, logs are located at C:\Windows\SystemTemp\runsafe\logs.

Note: Logging must be enabled before the service is started. If you need to restart the service, run the following

runsafe_sbom service stop
runsafe_sbom service start

Be aware, this will drop all previously generated SBOM data.

License Validation

No License Key Specified

If the license key is not correctly specified, you will encounter the following error message.

No Runsafe license information provided.

To configure the license key, see the Initialization and Retrieving Offline License Files sections as needed.

Unable To Communicate With Server

If installed RunSafe SBOM package is unable to communicate with the RunSafe license server, you will encounter the following error message.

License checker failed to communicate with license server.

If in a debian-based Linux environment, ensure the ca-certificates dependency is installed, and try again.

If the RunSafe SBOM generator must be run in an offline environment, or the ca-certificates dependency cannot be installed, refer to the Retrieving Offline License Files section.

Invalid License

If a license key is found, but considered invalid, you will encounter the following error message.

Your RunSafe license is invalid.

Verify the license key is correct in the config.toml. On a Linux system that will be located at /usr/share/runsafe/config.toml. In Windows, it will be located at %LOCALAPPDATA%\RunSafe\config.toml.

If it is incorrect in the config.toml, update the loaded license key by following the steps listed in the Initialization section again.

If the license key in the config.toml is correct, and you continue to experience an invalid license error, contact support@runsafesecurity.com for further assistance.

Environment Variables

Shared Environment Variables

VariableValue(s)Use
RUNSAFE_SBOM_IDex: ci_job_idManually define the unique identifier of the SBOM.
RUNSAFE_AUDIT_IDex: ci_pipeline_idManually define the unique identifier of the audit - particularly useful for grouping sboms by project.
RUNSAFE_SBOM_LOG_LEVELerror, warn, debug, traceControl logging verbosity. Default to stdout.
RUNSAFE_SBOM_FILE_LOGGERtrue, falseLog to a file. See readmes for more info.

Library-specific Environment Variables

VariableValue(s)Use
RUNSAFE_SBOM_LIBRARY_ONLYtrue, falseDon't report on source files. Data would have to be regenerated to include them. Data is filtered at the library level so report --raw-data will not be useful.

Note: Avoid using RUNSAFE_SBOM_LIBRARY_ONLY unless absolutely necessary. It will be deprecated in favor of a package-only mode and often confuses customers more because they expect a library package instead of a library file. It is better to explain the value of included source files, specifically with regards to the author, copyright, and license fields.

Service-specific Environment Variables

VariableValue(s)Use
RUNSAFE_LICENSE_KEYacquired license keyOverride the key value specified in the config.toml for license verification with the RunSafe license server.
RUNSAFE_SBOM_SERVERapp.runsafesecurity.comOverride the default sbom server URL for use with an on-prem RunSafe Identify instantiation.
RUNSAFE_SBOM_LOG_DIRex: /var/log/runsafeOverride the default directory where service logs are stored.
RUNSAFE_LICENSE_DIRex: /runsafe/licenseOverride the default directory where license files are stored. NOTE This directory must have the key.pub in this directory for the service to work.
RUNSAFE_SBOM_VERSION_IDex: 2Set the SBOM Version ID as denoted in the CycloneDX v1.6 SBOM.
RUNSAFE_SBOM_METADATA_COMPONENT_NAMEex: WolfSSLSet the top-level component name as denoted in the CycloneDX v1.6 SBOM.
RUNSAFE_SBOM_METADATA_COMPONENT_VERSIONex: 5.8.2Set the top-level component version as denoted in the CycloneDX v1.6 SBOM.
RUNSAFE_SBOM_METADATA_COMPONENT_SUPPLIERex: WolfSSLSet the top-level component supplier as denoted in the CycloneDX v1.6 SBOM.
RUNSAFE_SBOM_MASK_PATHSex: trueSet the component's path based off of the root component masking absolute paths.
RUNSAFE_SBOM_NO_PROXYex: trueSets the license checker to not use a proxy when connecting to Platform.
RUNSAFE_SBOM_PKG_GROUPINGex: trueGroup files by package where available in the generated SBOM.
RUNSAFE_SBOM_PKG_TIMEOUT_SECSex: 15Set the package source timeout to reduce the time cost during generate.

Commandline Arguments

Note: The --help flag is the best way to gain detailed information about the possible commandline arguments and is available for every command and sub-command.

The runsafe_sbom executable has seven top-level commands.

CommandDescription
upload-sbomUpload an SBOM directly to the RunSafe Identify Platform.
configOperate on the configuration file.
generateGenerate a CycloneDX SBOM.
serviceInteract with the SBOM service.
initInitialize the environment for SBOM generation.
reportGenerate SBOM status reports.
logsInteract with any logs not flushed to a file yet.

Upload-sbom

Flags

ArgumentDescription
--inputSBOM file path for upload.

Config

Positional Arguments

ArgumentValues(s)Description
actionvalidateAction to take on the configuration file.

Flags

ArgumentDefault ValueDescription
--config-file/usr/share/runsafe/config.tomlSBOM file path for upload.

Generate

Flags

ArgumentDescription
--sbom-idSBOM ID of the data to generate an SBOM for.
--audit-idAudit ID of the data to generate an SBOM for.
--most-recentGenerate an SBOM of the most recently created data.
--output-fileOutput path for the generated SBOM.

Service

Sub-Commands

ArgumentDescription
startStart the service.
stopStop the service.
statusDisplay the status of the service.

Flags

ArgumentDescription
--verboseDisplay verbose data output by the status command

Init

Flags

ArgumentDescription
--yesDisplay verbose data output by the status command

Report

Flags

ArgumentDescription
--output-fileDirect output to a file instead of stdout.
--unrecognizedReports on all unrecognized components.
--raw-dataCreate a detailed report log of all collected components, sorted by SBOM ID and audit ID pairs.
--sbom-idSBOM ID of the data to generate an SBOM for.
--audit-idAudit ID of the data to generate an SBOM for.

Logs

Sub-Commands

ArgumentDescription
flushFlush any remaining logs to the log file.

Configuration File Settings

FieldTypeExampleDescription
license_keyoptional[string]"super_secret_key"RunSafe License Key, optional if you want to use offline mode
sbom_idoptional[string]"myprojectname"SBOM Identifier used during gathering of data and as part of the output file name
audit_idoptional[string]>"companyname"Audit Identifier used during gathering of data and as part of the output file name
exclude_directoriesoptional[array[string]]["/my_project_dir/test"]Array of directories to exclude, can be glob format i.e. /test/*.
log_leveloptional[string]"debug"Specify log level of the tooling, default is off. Can be one of debug, info, warn, error
file_loggeroptional[boolean]trueDetermines logs to go a file instead of stdout by default.
log_diroptional[path]"/tmp/runsafe/logs/"Directory to place the log files
metadata_component_nameoptional[string]"tool_name"The tool's root component name.
metadata_component_versionoptional[string]"1.0.0"The tool's root component version.
metadata_component_supplieroptional[string]"companyname"The tool's root component supplier.
componentsoptional[array[component_config]]N/AAn array of component_config elements.
component_config.by_namestring"foo*"Required way to match components by name of the component. Mutually exclusive with by_path
component_config.by_pathstring OR array[string]"/usr/runsafe/bin/*" or ["/usr/runsafe/bin/*", "/tmp/runsafe/*"]Required way to match components by path of the component. Mutually exclusive with by_name
component_config.licenseoptional[string]"MIT"Assign component license with this license.
component_config.cpeoptional[string]"cpe:2.3:a:bar:foo:1.22.0:*:*:*:*:*:*:*"Override CPE definition if not found (does not account for found packages during purl detection)
component_config.aliasesoptional[array[string]]"foobar"Add aliases to the component.
component_config.supplieroptional[string]"RunSafe"Specify the supplier for the component.
component_config.versionoptional[string]"0.1.0"Specify the version for the component.
component_config.copyrightoptional[string]"Copyright RunSafe @ 2025"Specify the copyright for the component.
component_config.propertiesoptional[array[property]]N/AAn array of property elements for the component.
component_config.tagsoptional[array[string]]["compiled"]An array of tags for the component.
property.namestring"is_local"Name of the property
property.valuestring"true"Value of the property

Example Process: Hello World

Linux

Execute the following to generate an example SBOM assuming that the RunSafe SBOM tool is installed.

export RUNSAFE_LICENSE_KEY=<license_pulled_from_portal>
runsafe_sbom init

mkdir hello && cd hello
cat <<EOF > hello.c
##include <stdio.h>

int main() {
printf("Hello, World!\n");

return 0;
}
EOF

runsafe_sbom -- gcc hello.c -o hello
runsafe_sbom generate --most-recent \
--output-file=hello.cdx.json

The hello SBOM will be available at hello.cdx.json.

Windows

Execute the following in a privileged command prompt.

cd <path\of\containing\runsafe_sbom_<ver>.zip>
tar -xf runsafe_sbom_<ver>.zip
cd runsafe_sbom_<ver>
set RUNSAFE_LICENSE_KEY=<license_pulled_from_portal>
.\bin\runsafe_sbom.exe init -y

## Ensure you have the 'gcc' tool for compilation.
md hello
cd hello

Create the hello.c source file.

##include <stdio.h>

int main() {
printf("Hello, World!\n");

return 0;
}

Continue with compilation in an unprivileged command prompt.

%LOCALAPPDATA%\RunSafe\bin\runsafe_sbom.exe gcc hello.c -o hello.o
%LOCALAPPDATA%\RunSafe\bin\runsafe_sbom.exe generate --most-recent --output-file hello.cdx.json

The hello SBOM will be available at hello.cdx.json.

Example GitLab CI Yaml

Add the RunSafe license key to the project's environment variables, and make the package available in the root directory of the project. Refer to the License Acquisition section for instructions on how to retrieve a license key.

We recommend using docker build to create a container image with the RunSafe SBOM Generator package already installed. However, for the purpose of this example, it is assumed the package is available through other means and needs to be installed as a part of the build.

build-hello:
image: gcc
stage: build
script:
- sudo apt update && apt install -y ca-certificates
- sudo dpkg -i runsafe_sbom_<ver>.<arch>.deb
- runsafe_sbom init -y
- runsafe_sbom -- make -C hello/
- runsafe_sbom generate --most-recent --output-file hello.cdx.json
artifacts:
paths:
- hello.cdx.json