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/.
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.
| Field | Type | Description |
|---|---|---|
product_id | INT | Primary Key. Unique identifier for each product. |
manufacturer | VARCHAR(128) | The manufacturer of the product (e.g., "AVM", "TP-Link"). |
product_name | VARCHAR(255) | The name of the product (e.g., "FRITZ!Box 7590"). |
inserted_at | DATETIME | The 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.
| Field | Type | Description |
|---|---|---|
image_id | INT | Primary Key. Unique identifier for each firmware image. |
checksum | CHAR(128) | Unique checksum of the locally stored firmware image. |
partial_checksum | CHAR(64) | A partial checksum of the firmware image. |
checksum_scraped | CHAR(128) | The checksum provided by the source. |
image_architecture | VARCHAR(128) | The image's target architecture. |
image_type | VARCHAR(255) | The type of firmware image. |
download_link | VARCHAR(1024) | The URL from which the firmware can be downloaded. |
download_status | ENUM | Download state: pending, success, downloading, or failed. |
download_status_message | VARCHAR(1024) | Additional information about the download state or failure. |
file_path | VARCHAR(1024) | The local path of the downloaded firmware file. |
original_dl_file_path | VARCHAR(1024) | The original path or name of the downloaded file. |
version | VARCHAR(128) | The version of the firmware. |
release_date | DATE | The release date of the firmware. |
runner_uuid | CHAR(128) | Identifier of the runner that processed the firmware. |
additional_data | JSON | Additional image metadata. |
products_images
This mapping table implements the many-to-many relationship between products and firmware images.
| Field | Type | Description |
|---|---|---|
product_id | INT | Primary and Foreign Key to products.product_id; deleted with its product. |
image_id | INT | Primary 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.
| Field | Type | Description |
|---|---|---|
job_id | INT | Primary Key. Unique identifier for each job. |
job_name | VARCHAR(128) | The name of the job. |
inserted_at | TIMESTAMP | The timestamp when the job was created. |
tools | VARCHAR(2048) | A list of analysis tools to be used in the job. |
images | VARCHAR(2048) | A list of image IDs (images.image_id) to be analyzed in the job. |
cron_expression | VARCHAR(255) | A cron expression that defines when the job should be run. |
reanalyze | BOOLEAN | A flag indicating if the images should be re-analyzed even if they have been analyzed before. |
disabled | BOOLEAN | A flag to enable or disable the job. |
tasks_created | INT | The number of tasks created for this job. |
tasks_completed | INT | The 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.
| Field | Type | Description |
|---|---|---|
task_id | INT | Primary Key. Unique identifier for each task. |
job_id | INT | Foreign Key to jobs.job_id. The job this task belongs to. |
image_id | INT | Foreign Key to images.image_id. The firmware image this task runs on. |
output_path | VARCHAR(1024) | Task output directory shared by the per-tool logs and reports. |
execution_nr | INT | The execution number of this task. |
execution_time | TIMESTAMP | The timestamp when the task was executed. |
exec_successfull | BOOLEAN | A 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.
| Field | Type | Nullable | Description |
|---|---|---|---|
analysis_id | INT | No | Auto-increment primary key. |
job_id | INT | No | Foreign key to jobs.job_id. |
image_id | INT | No | Foreign key to images.image_id. |
tool_id | INT | No | Foreign key to tools.id. |
execution_nr | INT | No | Execution number within the job. |
status | VARCHAR(32) | No | success, failure, timeout or skipped; normalized by the executor. |
status_message | VARCHAR(1024) | Yes | Completion summary or diagnostic message. |
finding_count | INT | Yes | Reported count: 0 means a successful empty result; NULL means unknown or incomplete. |
output_path | VARCHAR(1024) | Yes | Path to the per-tool text log; structured-report paths are derived from it. |
completed_at | DATETIME | No | Completion 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.
| Field | Type | Description |
|---|---|---|
result_id | INT | Primary Key. Unique identifier for the result. |
image_id | INT | Foreign Key to images.image_id. The firmware image this result belongs to. |
vendor | VARCHAR(50) | The vendor of the component with the CVE. |
product | VARCHAR(50) | The product name of the component with the CVE. |
version | VARCHAR(32) | The version of the component with the CVE. |
cve_number | VARCHAR(16) | The CVE number (e.g., "CVE-2021-12345"). |
severity | VARCHAR(8) | The severity of the CVE (e.g., "High", "Medium", "Low"). |
score | VARCHAR(10) | The CVSS score of the CVE. |
source | VARCHAR(20) | The source of the CVE information. |
cvss_version | VARCHAR(8) | The version of the CVSS standard used. |
cvss_vector | VARCHAR(64) | The CVSS vector string. |
paths | VARCHAR(4096) | The file paths where the vulnerable component was found, relative to the scanned root file system (e.g. /bin/busybox). |
remarks | VARCHAR(20) | Any remarks about the result. |
comments | VARCHAR(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.
| Field | Type | Description |
|---|---|---|
result_id | INT | Primary Key. Unique identifier for the result. |
image_id | INT | Foreign Key to images.image_id. The firmware image this result belongs to. |
offset | INT | The offset in the firmware image where the data was found. |
description | VARCHAR(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.
| Field | Type | Description |
|---|---|---|
id | INT | Primary Key. Unique identifier for the SBOM component. |
name | VARCHAR(255) | The name of the component. |
version | VARCHAR(255) | The version of the component. |
type | VARCHAR(50) | The type of the component (e.g., "library", "application"). |
cpe | VARCHAR(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.
| Field | Type | Description |
|---|---|---|
image_id | INT | Primary and Foreign Key to images.image_id; deleted with its image. |
component_id | INT | Primary and Foreign Key to sbom_components.id; deleted with its component. |
tools
This table stores information about the analysis tools available in the system.
| Field | Type | Description |
|---|---|---|
id | INT | Primary Key. Unique identifier for the tool. |
name | VARCHAR(255) | The unique name of the tool. |
tool_dependencies
This table defines dependencies between tools.
| Field | Type | Description |
|---|---|---|
tool_id | INT | Foreign Key to tools.id. The tool that has a dependency. |
dependency_id | INT | Foreign 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.
| Field | Type | Description |
|---|---|---|
result_id | INT | Primary Key. Unique identifier for the result. |
image_id | INT | Foreign Key to images.image_id. The firmware image this result belongs to. |
file_path | VARCHAR(1024) | The path to the file where the secret was found. |
line_number | INT | The line number where the secret was found. |
detector_name | VARCHAR(255) | The name of the detector that found the secret. |
decoder_name | VARCHAR(255) | The name of the decoder used. |
secret_raw | TEXT | The raw secret that was found. |
secret_raw2 | TEXT | Additional 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.
| Field | Type | Description |
|---|---|---|
result_id | INT | Primary Key, auto increment. Unique identifier for the result. |
image_id | INT | Foreign Key to images.image_id. The firmware image this result belongs to. |
root_path | VARCHAR(1024) | The root path of the firmware filesystem. |
init_system | VARCHAR(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_script | VARCHAR(1024) | The main system initialization script. |
default_target | VARCHAR(255) | The default target or runlevel. |
targets | TEXT | A list of available targets or runlevels. |
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.