Debian Codegraph @

README.md

raw
1 [![Tests](https://github.com/siemens/debsbom/actions/workflows/test.yml/badge.svg)](https://github.com/siemens/debsbom/actions/workflows/test.yml)
2 [![Documentation](https://github.com/siemens/debsbom/actions/workflows/docs.yml/badge.svg)](https://siemens.github.io/debsbom)
3
4 # debsbom - SBOM generator for Debian-based distributions
5
6 `debsbom` generates SBOMs (Software Bill of Materials) for distributions based on Debian in the two standard formats [SPDX](https://www.spdx.org) and [CycloneDX](https://www.cyclonedx.org).
7
8 The generated SBOM includes all installed binary packages and also contains [Debian Source packages](https://www.debian.org/doc/debian-policy/ch-source.html).
9
10 Source packages are especially relevant for security as CVEs in the Debian ecosystem are filed not against the installed binary packages, but source packages. The names of source and binary packages must not always be the same, and in some cases a single source package builds a number of binary packages.
11
12 `debsbom` also provides a complete dependency graph for the analyzed system. This graph is useful for identification of crucial components in your distribution, or to identify which package pulled in vulnerabilites with its dependencies.
13
14 ## Usage
15
16 Please refer to the [debsbom documentation](https://siemens.github.io/debsbom/).
17
18 ```
19 usage: debsbom [-h] [--version] [-v] [--progress | --json] [--print-completion {bash,zsh,tcsh}] {generate,merge,download,source-merge,repack,export,delta,trace-path,filter,sec-scan} ...
20
21 SBOM tool for Debian systems.
22
23 positional arguments:
24 {generate,merge,download,source-merge,repack,export,delta,trace-path,filter,sec-scan}
25 sub command help
26 generate generate a SBOM for a Debian system
27 merge merge multiple SBOMs
28 download download referenced packages
29 source-merge merge referenced source packages
30 repack repack sources and sbom
31 export export SBOM as graph
32 delta list components changed in target SBOM
33 trace-path trace path between components
34 filter filter SBOM by sources or binaries
35 sec-scan check SBOM for security vulnerabilities
36
37 options:
38 -h, --help show this help message and exit
39 --version show program's version number and exit
40 -v, --verbose be more verbose
41 --progress report progress
42 --json make output machine readable
43 --print-completion {bash,zsh,tcsh}
44 print shell completion script
45 ```
46
47 ## Scope of the tool
48
49 The primary goal is to generate Software Bills of Materials (SBOMs) for Debian-based systems, focusing on security and license clearing requirements.
50 The `generate` command operates entirely offline, making it suitable for use in air-gapped networks or environments where internet connectivity is restricted.
51
52 ### Goals
53
54 The `generate` command creates comprehensive SBOMs that include all installed software packages and their dependencies (binary, source package and
55 `built-using`[[1]](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-built-using)).
56 These SBOM outputs are designed to serve as reliable input for vulnerability management systems and license compliance checks.
57
58 The tool provides auxiliary commands for package source retrieval. These enable users to:
59 1. Retrieve packages from Debian's upstream repositories and report missing packages.
60 2. Convert the multi-archive source packages into a single artifact (one archive per source package)
61
62 At its core, this tool was designed to fulfill these SBOM generation requirements while maintaining:
63 1. A minimal dependency footprint: avoid huge dependency graph of external software ecosystems (like Go or Rust)
64 2. Strict focus on Debian-specific package formats
65 3. Clear separation between binary packages and their corresponding source packages
66 4. Use official SPDX / CycloneDX libraries to ensure syntactic and semantic correctness
67
68 ### Non Goals
69
70 - License and copyright text extraction from source packages
71 - Signing and attestation of generated artifacts
72
73 ## Package Relations
74
75 A Debian distribution is composed of source packages and binary packages.
76 Binary packages are installed into the root filesystem, while the source packages are the originals from which those binaries are built.
77
78 Some binary packages are installed explicitly by the user; others appear automatically as dependencies of the explicitly‑installed packages.
79 The SBOM mirrors this relationship, using the `distro-package` entry as the single central node for traversing the package graph.
80
81 ```
82 distro-package
83 ├─ binary-package-foo
84 ├─── source-package-foo
85 ├─── binary-dep-of-foo
86 ├─ binary-package-bar
87 ├─── source-package-bar
88 └─── binary-dep-of-bar
89 ```
90
91 ### Source-Binary
92
93 To differentiate binary and source packages in the SBOM a different approach for each SBOM standard is required.
94
95 #### CycloneDX
96
97 In the CDX format it is currently not possible to mark a component as a source package. There is an ongoing discussion [[2]](https://github.com/CycloneDX/specification/issues/612) which, while looking promising, will not land in the standard for quite some time. In the meantime source packages can only be identified by their PURL by looking at the `arch=source` qualifier. The relationships between a binary and its source package is done with a simple dependency.
98
99 #### SPDX
100
101 We differentiate a source package by setting `"primaryPackagePurpose": "SOURCE"` as opposed to `LIBRARY` for binary packages. Their relationship is expressed with the `GENERATES` relation. For packages that are marked as `Built-Using` in the dpkg status file, we use the `GENERATED_FROM` relation. This expresses the same semantic in SPDX, but this way it can still be identified if it is a proper source/binary relationship or a built-using one.
102
103 ## Limitations
104
105 ### Vendor Packages
106
107 Vendor packages are currently not identified. Identifying them is important to emit the correct PURL. Right now we make no difference between vendor and official packages. That means we emit potentially incorrect PURLs for vendor packages.
108
109 Reliably and correctly identifying if a package is a vendor package or not is non-trivial without access to the internet. For this reason we do not attempt it. If you have vendor packages in your distribution we assume you know them, and if not you can identify them in postprocessing. A simple way is to use `debsbom download` and look for any packages that failed to download, or whose checksums do not match.
110
111 ## Maintainer GPG Fingerprints
112
113 All release tags since v0.7.0 are signed by either one of these keys:
114
115 - Christoph Steiger <[email protected]> 697D7C50105888561F3DA813FD19209BD779F314
116 - Felix Mößbauer <[email protected]> 3785ED68D0F83B7BD7D23D7FE1136CEB2754A0BD