Skip to main content

Database Schema

This document describes the database schema of the Firmware Vault. The database is designed to store information about firmware, analysis jobs, tasks, and the results of various analysis tools.

The authoritative schema is defined by the Alembic migrations in src/alembic/versions/.

Database schema changes

Every change to the database schema must include a new migration, and that migration must be applied to the database. See Database Migrations for the required workflow and commands.

Tables​

products​

This table stores product metadata. Firmware images are stored separately in images and linked through products_images.

FieldTypeDescription
product_idINTPrimary Key. Unique identifier for each product.
manufacturerVARCHAR(128)The manufacturer of the product (e.g., "AVM", "TP-Link").
product_nameVARCHAR(255)The name of the product (e.g., "FRITZ!Box 7590").
inserted_atDATETIMEThe timestamp when the product record was inserted into the database.

The combination of manufacturer and product_name is unique.

images​

This table stores downloadable firmware images and their image-specific metadata.

FieldTypeDescription
image_idINTPrimary Key. Unique identifier for each firmware image.
checksumCHAR(128)Unique checksum of the locally stored firmware image.
partial_checksumCHAR(64)A partial checksum of the firmware image.
checksum_scrapedCHAR(128)The checksum provided by the source.
image_architectureVARCHAR(128)The image's target architecture.
image_typeVARCHAR(255)The type of firmware image.
download_linkVARCHAR(1024)The URL from which the firmware can be downloaded.
download_statusENUMDownload state: pending, success, downloading, or failed.
download_status_messageVARCHAR(1024)Additional information about the download state or failure.
file_pathVARCHAR(1024)The local path of the downloaded firmware file.
original_dl_file_pathVARCHAR(1024)The original path or name of the downloaded file.
versionVARCHAR(128)The version of the firmware.
release_dateDATEThe release date of the firmware.
runner_uuidCHAR(128)Identifier of the runner that processed the firmware.
additional_dataJSONAdditional image metadata.

products_images​

This mapping table implements the many-to-many relationship between products and firmware images.

FieldTypeDescription
product_idINTPrimary and Foreign Key to products.product_id; deleted with its product.
image_idINTPrimary and Foreign Key to images.image_id; deleted with its image.

jobs​

This table contains information about the analysis jobs that can be run on the firmware images.

FieldTypeDescription
job_idINTPrimary Key. Unique identifier for each job.
job_nameVARCHAR(128)The name of the job.
inserted_atTIMESTAMPThe timestamp when the job was created.
toolsVARCHAR(2048)A list of analysis tools to be used in the job.
imagesVARCHAR(2048)A list of image IDs (images.image_id) to be analyzed in the job.
cron_expressionVARCHAR(255)A cron expression that defines when the job should be run.
reanalyzeBOOLEANA flag indicating if the images should be re-analyzed even if they have been analyzed before.
disabledBOOLEANA flag to enable or disable the job.
tasks_createdINTThe number of tasks created for this job.
tasks_completedINTThe number of tasks that have been completed for this job.

tasks​

This table represents the analysis of one firmware image within a job run. A task can contain several tools; their individual outcomes are stored in analysis_executions.

FieldTypeDescription
task_idINTPrimary Key. Unique identifier for each task.
job_idINTForeign Key to jobs.job_id. The job this task belongs to.
image_idINTForeign Key to images.image_id. The firmware image this task runs on.
output_pathVARCHAR(1024)Task output directory shared by the per-tool logs and reports.
execution_nrINTThe execution number of this task.
execution_timeTIMESTAMPThe timestamp when the task was executed.
exec_successfullBOOLEANA flag indicating if the task execution was successful.

analysis_executions​

One row records one tool execution for an image, not another copy of its findings. Automatically started dependencies and tools with final status skipped also have records. Pending and running states remain in Redis, not in this table.

FieldTypeNullableDescription
analysis_idINTNoAuto-increment primary key.
job_idINTNoForeign key to jobs.job_id.
image_idINTNoForeign key to images.image_id.
tool_idINTNoForeign key to tools.id.
execution_nrINTNoExecution number within the job.
statusVARCHAR(32)Nosuccess, failure, timeout or skipped; normalized by the executor.
status_messageVARCHAR(1024)YesCompletion summary or diagnostic message.
finding_countINTYesReported count: 0 means a successful empty result; NULL means unknown or incomplete.
output_pathVARCHAR(1024)YesPath to the per-tool text log; structured-report paths are derived from it.
completed_atDATETIMENoCompletion timestamp; server default CURRENT_TIMESTAMP.

The unique constraint uq_analysis_execution covers (job_id, image_id, execution_nr, tool_id). Repeated Redis returns update the existing execution rather than adding another row. The index ix_analysis_executions_image_completed covers (image_id, completed_at) for image history queries.

Migration 6f8f1f2a4c91 creates the table and backfills existing task history. Historical statuses are inferred from the combined task outcome, counts remain NULL, and output paths point to the old combined output.txt. No scanner is rerun during migration. Merge revision b7c42a90e615 joins this migration with the boot-analysis fixes from main without adding another table. See Database Migrations.

Findings continue to use the existing tool-specific result tables below. Full per-run entries and summary reports are stored in files, not as another JSON copy in this table. See Analysis Results API and Files for the file format and API reference.

cve_results​

This table stores the results of the CVE (Common Vulnerabilities and Exposures) analysis.

FieldTypeDescription
result_idINTPrimary Key. Unique identifier for the result.
image_idINTForeign Key to images.image_id. The firmware image this result belongs to.
vendorVARCHAR(50)The vendor of the component with the CVE.
productVARCHAR(50)The product name of the component with the CVE.
versionVARCHAR(32)The version of the component with the CVE.
cve_numberVARCHAR(16)The CVE number (e.g., "CVE-2021-12345").
severityVARCHAR(8)The severity of the CVE (e.g., "High", "Medium", "Low").
scoreVARCHAR(10)The CVSS score of the CVE.
sourceVARCHAR(20)The source of the CVE information.
cvss_versionVARCHAR(8)The version of the CVSS standard used.
cvss_vectorVARCHAR(64)The CVSS vector string.
pathsVARCHAR(4096)The file paths where the vulnerable component was found, relative to the scanned root file system (e.g. /bin/busybox).
remarksVARCHAR(20)Any remarks about the result.
commentsVARCHAR(16)Any comments about the result.

binwalk_results​

This table stores the results from the binwalk tool, which is used to analyze firmware images for extractable file systems and other binary data.

FieldTypeDescription
result_idINTPrimary Key. Unique identifier for the result.
image_idINTForeign Key to images.image_id. The firmware image this result belongs to.
offsetINTThe offset in the firmware image where the data was found.
descriptionVARCHAR(2000)The description of the data found by binwalk.

sbom_components​

This table stores information about Software Bill of Materials (SBOM) components found in the firmware images.

FieldTypeDescription
idINTPrimary Key. Unique identifier for the SBOM component.
nameVARCHAR(255)The name of the component.
versionVARCHAR(255)The version of the component.
typeVARCHAR(50)The type of the component (e.g., "library", "application").
cpeVARCHAR(255)The CPE (Common Platform Enumeration) string for the component.

sbom_to_products​

This is a mapping table that links SBOM components to the firmware images in which they were found.

FieldTypeDescription
image_idINTPrimary and Foreign Key to images.image_id; deleted with its image.
component_idINTPrimary and Foreign Key to sbom_components.id; deleted with its component.

tools​

This table stores information about the analysis tools available in the system.

FieldTypeDescription
idINTPrimary Key. Unique identifier for the tool.
nameVARCHAR(255)The unique name of the tool.

tool_dependencies​

This table defines dependencies between tools.

FieldTypeDescription
tool_idINTForeign Key to tools.id. The tool that has a dependency.
dependency_idINTForeign Key to tools.id. The dependency tool.

trufflehog_results​

This table stores the results from the trufflehog tool, which searches for secrets and credentials in the firmware.

FieldTypeDescription
result_idINTPrimary Key. Unique identifier for the result.
image_idINTForeign Key to images.image_id. The firmware image this result belongs to.
file_pathVARCHAR(1024)The path to the file where the secret was found.
line_numberINTThe line number where the secret was found.
detector_nameVARCHAR(255)The name of the detector that found the secret.
decoder_nameVARCHAR(255)The name of the decoder used.
secret_rawTEXTThe raw secret that was found.
secret_raw2TEXTAdditional raw secret data.

boot_analysis_results​

This table stores the results of the boot analysis, one row per run. The script and binary dependency trees are only stored in boot-analysis-output.json.

FieldTypeDescription
result_idINTPrimary Key, auto increment. Unique identifier for the result.
image_idINTForeign Key to images.image_id. The firmware image this result belongs to.
root_pathVARCHAR(1024)The root path of the firmware filesystem.
init_systemVARCHAR(50)The detected init system: systemd, sysvinit, openrc, upstart, custom, or for BusyBox init the firmware variant openwrt, ddwrt, buildroot or busybox (see Boot Analysis).
sysinit_scriptVARCHAR(1024)The main system initialization script.
default_targetVARCHAR(255)The default target or runlevel.
targetsTEXTA list of available targets or runlevels.
note

Until migration 9561599ff4a3, result_id had neither a primary key nor auto increment (side effect of the initial migration 83812b476ccf), so storing boot analysis results failed with Field 'result_id' doesn't have a default value. The migration fixes this and widens the path columns, which can exceed 255 characters for nested extraction folders.