Debian Codegraph @

docs/source/intro.rst

raw
1 Introduction
2 ============
3
4 .. include:: /intro-basics.inc
5
6 Scope of the tool
7 -----------------
8
9 The primary goal is to generate Software Bills of Materials (SBOMs) for Debian-based systems, focusing on security and license clearing requirements.
10 The ``generate`` command operates entirely offline, making it suitable for use in air-gapped networks or environments where internet connectivity is restricted.
11
12 Goals
13 ~~~~~
14
15 The tool provides auxiliary commands for package source retrieval. These enable users to:
16
17 1. Retrieve packages from Debian's upstream repositories and report missing packages.
18 2. Convert the multi-archive source packages into a single artifact (one archive per source package)
19
20 At its core, this tool was designed to fulfill these SBOM generation requirements while maintaining:
21
22 1. A minimal dependency footprint: avoid huge dependency graph of external software ecosystems (like Go or Rust)
23 2. Strict focus on Debian-specific package formats
24 3. Clear separation between binary packages and their corresponding source packages
25 4. Use official SPDX / CycloneDX libraries to ensure syntactic and semantic correctness
26
27 Non-Goals
28 ~~~~~~~~~
29
30 - License and copyright text extraction from source packages
31 - Real-time vulnerability database integration
32 - Signing and attestation of generated artifacts
33
34 Package Relationships
35 ---------------------
36
37 A Debian distribution is composed of source packages and binary packages.
38 Binary packages are installed into the root filesystem, while the source packages are the originals from which those binaries are built.
39
40 Some binary packages are installed explicitly by the user; others appear automatically as dependencies of the explicitly‑installed packages.
41 The SBOM mirrors this relationship, using the ``distro-package`` entry as the single central node for traversing the package graph.
42
43 Relationship hierarchy::
44
45 distro-package
46 ├─ binary-package-foo
47 ├─── source-package-foo
48 ├─── binary-dep-of-foo
49 ├─ binary-package-bar
50 ├─── source-package-bar
51 └─── binary-dep-of-bar
52
53 Source-Binary
54 ~~~~~~~~~~~~~
55
56 To differentiate binary and source packages in the SBOM a different approach for each SBOM standard is required.
57
58 CycloneDX
59 ^^^^^^^^^
60
61 In the CDX format it is currently not possible to mark a component as a source package.
62 There is an ongoing discussion [#f1]_ which, while looking promising, will not land in the standard for quite some time.
63 In the meantime source packages can only be identified by their PURL by looking at the ``arch=source`` qualifier.
64 The relationships between a binary and its source package is done with a simple dependency.
65
66 SPDX
67 ^^^^
68
69 We differentiate a source package by setting ``"primaryPackagePurpose": "SOURCE"`` as opposed to ``LIBRARY`` for binary packages.
70 Their relationship is expressed with the ``GENERATES`` relation.
71 For packages that are marked as ``Built-Using`` in the dpkg status file, we use the ``GENERATED_FROM`` relation.
72 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.
73
74 Limitations
75 -----------
76
77 Vendor Packages
78 ~~~~~~~~~~~~~~~
79
80 Vendor packages are currently not identified.
81 Identifying them is important to emit the correct PURL.
82 Right now we make no difference between vendor and official packages.
83 That means we emit potentially incorrect PURLs for vendor packages.
84
85 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.
86
87
88 .. rubric:: Footnotes
89
90 .. [#f1] https://github.com/CycloneDX/specification/issues/612