Skip to content

Commit f9b4aeb

Browse files
committed
Create PACKAGE_METADATA.md
Initial creation of package metadata file which will contain information about the structure of the files within Distroless images.
1 parent 4c40ba7 commit f9b4aeb

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

PACKAGE_METADATA.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Package Metadata
2+
3+
## `dpkg` Metadata Structure Standard
4+
5+
### Overview
6+
7+
This document defines the standard structure for `dpkg` metadata within Google Distroless Debian-based images. The goal is to provide a clear specification for tool authors and users, enabling consistent and accurate results for vulnerability (CVE) scanning and package analysis.
8+
9+
### Directory Structure
10+
11+
Distroless Debian images differ from traditional Debian images in their handling of `dpkg` metadata. The relevant structure is as follows:
12+
13+
```
14+
/var/lib/dpkg/
15+
└── status.d/
16+
├── <package>
17+
└── <package>.md5sums
18+
```
19+
20+
### Details
21+
22+
- **`/var/lib/dpkg/status.d/`**
23+
- Contains one file per installed package.
24+
- Each file is named after the package (e.g., `libc6`, `libssl1.1`).
25+
26+
- **`/var/lib/dpkg/status.d/<package>`**
27+
- Contains package metadata, equivalent to the output of:
28+
```
29+
dpkg-deb --field <package>.deb > /var/lib/dpkg/status.d/<package>
30+
```
31+
32+
- **`/var/lib/dpkg/status.d/<package>.md5sums`**
33+
- Contains file checksums, equivalent to the output of:
34+
```
35+
dpkg-deb --control <package>.deb CONTROL
36+
cp CONTROL/md5sums /var/lib/dpkg/status.d/<package>.md5sums
37+
rm -rf CONTROL
38+
```
39+
40+
### Omitted Files
41+
42+
Distroless images intentionally omit several files found in standard Debian images:
43+
44+
- `/var/lib/dpkg/status`
45+
- **Not present.** Replaced by the `status.d` directory.
46+
47+
- `/var/lib/dpkg/info/<package>.list`
48+
- **Not present.** File lists can be inferred from the `.md5sums` files.
49+
50+
- `/var/lib/dpkg/info/<package>.md5sums`
51+
- **Not present.** Checksums are stored in `status.d/<package>.md5sums`.
52+
53+
- Other `/var/lib/dpkg/info/<package>.*` files
54+
- **Not present.** Not required for CVE scanning.
55+
56+
### Rationale
57+
58+
- **Minimalism:**
59+
Distroless images remove unnecessary files to reduce image size and attack surface.
60+
61+
- **CVE Scanning Compatibility:**
62+
The provided metadata is sufficient for most vulnerability scanners to identify installed packages and their versions.
63+
64+
- **Avoiding Conflicts:**
65+
Using the `status.d` directory exclusively prevents confusion or potential issues that could arise if files conflicted with default `dpkg` folders. This approach ensures compatibility, especially if `dpkg` is used directly within the image.
66+
67+
### Guidance for Tool Authors
68+
69+
- Scan `/var/lib/dpkg/status.d/` for installed package metadata.
70+
- Use `<package>` files for package details.
71+
- Use `<package>.md5sums` for file checksums and file lists.
72+
- Do not expect `/var/lib/dpkg/status` or `/var/lib/dpkg/info/` files.

0 commit comments

Comments
 (0)