Files
pruefwerk/docs/guide/yocto.md
T
sharang 860d1a78bf
CI / Detect Changes (push) Successful in 4s
CI / Deploy Docs (push) Successful in 1m14s
CI / Deploy MCP (push) Successful in 4m30s
CI / Deploy Dashboard (push) Successful in 6m17s
CI / Deploy Agent (push) Successful in 8m0s
CI / Check (push) Skipped
fix(eol): end-of-life findings are high, soon is medium, and non-LTS Yocto releases warn two months ahead (#562)
2026-10-09 19:28:49 +00:00

308 lines
20 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Embedded Linux / Yocto
Yocto support is a **preview**. Prüfwerk recognises a Yocto / OpenEmbedded layer
tree and scans its sources today; the Yocto-specific analyses are being added in
three tiers, by what you can give us.
## Detection
A git repository or source archive is typed **Embedded Linux / Yocto** from what
it holds:
| Signal | Confidence |
| --- | --- |
| `conf/layer.conf` **and** BitBake recipes (`*.bb`, `*.bbappend`, `*.inc` under `recipes-*`) | high (0.8) |
| only one of the two | medium (0.65) |
| a kas project file (`kas*.yml`, `kas/*.yml`) | 0.6 |
| a build directory's `bblayers.conf` / `local.conf`, or poky's `oe-init-build-env` | low (0.5) |
`meta-*` layer directories and `conf/distro/*.conf` raise a medium or low verdict
slightly, but never decide on their own (`META-INF` is everywhere). C sources a
recipe ships in `files/` do not make the tree bare-metal firmware: the layer
outranks Firmwerk's reading of loose sources. A Zephyr or ESP-IDF project inside
the tree is still detected as RTOS firmware.
The wizard proposes the type after the first scan has read the code, as for every
other source-based type. The detection is stored on the target as facts:
`build_system = bitbake` and one `yocto_layer` per layer (the directory holding
its `conf/layer.conf`, `.` for the repository root). A `build/` directory is not
searched.
## What runs today
| Scan | Status |
| --- | --- |
| Secrets (Gitleaks), malware and committed binaries (ClamAV) | runs over the layer tree |
| Code analysis (Semgrep, Cppcheck) | runs over patches and the sources in `files/` |
| SBOM from lockfiles (Syft) | runs, but a layer has no lockfiles, so it is usually empty |
| Firmware SBOM (Firmwerk) | not run: listed under **Nicht ausgeführt** as "Yocto build analysis is planned (tier 2)" |
| Recipe lint (oelint-adv and our own rules) | runs over your layers, see below |
| Layer pins and Yocto release | runs: kas files, `repo` manifests and submodules, and a finding when the release is end of life; see [Layer pins and the Yocto release](#layer-pins-and-the-yocto-release) |
| Recipe inventory | runs: SBOM components and NVD CVEs from the recipes, `CVE_STATUS` and `CVE:` patches as VEX; see [Recipe inventory](#recipe-inventory) |
| In the image (declared) | runs: the recipes your image recipes install are marked; see [Im Image (deklariert)](#im-image-deklariert) |
| Image SBOM / CVE | needs build artefacts (SPDX / manifest), planned (tier 2) |
| DAST | opt-in, with an http(s) address of the running device |
| Penetration test | not offered until an image can be booted in an emulation sandbox |
## Recipe lint
The recipes, appends, classes and the layer configuration are read without a
build. Findings have the type **Rezept-Prüfung (Yocto)** and name the CRA Annex I
requirement they concern. A layer is read with the oldest release its
`LAYERSERIES_COMPAT` names (`_append` syntax before Kirkstone, and rules that only
apply to older releases).
**oelint-adv** (BSD-2-Clause, pinned in the agent image) runs with its security
rules only, none of its style rules:
| Rule | Severity | CRA Annex I | Control |
| --- | --- | --- | --- |
| `oelint.var.badimagefeature.debug-tweaks`, `.allow-empty-password`, `.empty-root-password`, `.serial-autologin-root` | high | (2)(b) secure by default | CRA-AI-1, CRA-AI-8 |
| `oelint.var.badimagefeature.allow-root-login` | medium | (2)(b) | CRA-AI-1 |
| `oelint.var.badimagefeature.tools-debug`, `.dbg-pkgs`, `.dev-pkgs` | low | (2)(b) | CRA-AI-1 |
| `oelint.vars.srcurichecksum` (download without `SRC_URI[sha256sum]`) | medium | (2)(f) integrity | CRA-AI-6 |
| `oelint.vars.autorev` (`SRCREV = "${AUTOREV}"`) | medium | (2)(f) | CRA-AI-6 |
| `oelint.vars.srcurigittag` (git `tag=` instead of a commit; up to Walnascar) | low | (2)(f) | CRA-AI-6 |
| `oelint.task.network` (a task with `[network] = "1"`) | medium | (2)(j) attack surface | CRA-AI-2 |
| `oelint.vars.insaneskip` (QA checks skipped) | low | informational | none |
A `.oelint.cfg` in the repository is ignored, so it cannot switch rules off;
`# nooelint:` comments in a recipe do suppress a finding there, as oelint-adv
intends. Suppressed findings are not shown, so the run counts them and lists
"N Befunde sind per Kommentar in den Rezepten (# nooelint) unterdrückt" under
**Rezept-Prüfung: unterdrückte Befunde**. If oelint-adv does not complete, the run lists **Rezept-Prüfung (Yocto)**
under **Nicht ausgeführt**, and the controls it checks count as not assessed.
**Our own rules** (`yocto-config`):
| Rule | Finds | Severity | CRA Annex I | Control |
| --- | --- | --- | --- | --- |
| `yocto-extrausers-password` | `useradd`/`usermod` with `-p`/`-P`/`--password` in `EXTRA_USERS_PARAMS` (a hash, clear text or an empty password; `'*'` and `'!'` lock the account and are fine, a `${VARIABLE}` is not judged). The value is hidden in the finding. | high | (2)(b) | CRA-AI-8 |
| `yocto-src-uri-http` | `http://` or `protocol=http` in `SRC_URI` | medium | (2)(j) | CRA-AI-2 |
| `yocto-sshd-root-login` | `PermitRootLogin yes` in an `sshd_config*` shipped under `recipes-*` | high | (2)(b) | CRA-AI-1 |
| `yocto-sshd-password-auth` | `PasswordAuthentication yes` there | medium | (2)(b) | CRA-AI-1 |
| `yocto-distro-no-security-flags` | a `conf/distro/*.conf` that does not require `security_flags.inc`, itself or through the includes in the repository | medium | (2)(b) | CRA-AI-1 |
| `yocto-local-conf-no-security-flags` | a `local.conf.sample` with no `DISTRO` (or `nodistro`) and no `security_flags.inc` | info | (2)(b) | CRA-AI-1 |
| `yocto-files-certificate` | a certificate shipped under `recipes-*` | info | none | none |
Private keys under `files/` are reported by the secret scan (gitleaks), not a
second time here. A `require` through a variable, or of a file that is not in the
repository (Poky's distros, a BSP layer that kas fetches), cannot be followed, so
such a distro is not reported; an include in the repository is followed.
**Upstream layers** (OpenEmbedded-Core and Poky, meta-openembedded, and widely
used security, virtualisation and BSP layers, recognised by their
`BBFILE_COLLECTIONS`) are not linted: their findings are upstream's. The run names
them under **Nicht ausgeführt** as "Upstream-Layer". A layer is recognised by its
collection name, not its contents: a fork of an upstream layer that keeps the
upstream collection name (`core`, `openembedded-layer`, `freescale-layer`, …) is
skipped too. Give your fork its own collection name to have it linted.
CRA-AI-2 (minimal attack surface) is otherwise outside static scans. On a Yocto
layer tree, recipe lint checks it (network access in build tasks, plain-http
fetches), so the CRA status assesses it there; for every other target it stays
"not code-checkable".
## Layer pins and the Yocto release
The scan reads which layer repositories the build fetches, and at which
branch and commit, without fetching any of them. The pins are stored on the
target and shown on its page under **Layer-Stände** (*Layer pins*), with the
release they make up.
| Read from | What |
| --- | --- |
| kas project files (`kas*.yml` anywhere, any YAML file in a `kas/` directory) | every repository under `repos:` with a `url`: `branch`, `tag` or the older `refspec`, and `commit`; `defaults.repos.branch`; a lock file beside it (`kas.lock.yml`, `overrides.repos.<name>.commit`). A repository without `url` is the one the kas file is in and is not a pin. |
| kas includes (`header.includes`) | local files, relative to the including file or to the repository root, merged in before the including file's own settings, as kas does; an include cycle ends at the file already being read. An include from another repository (`repo:` / `file:`) or a URL is never fetched: it is listed under "Nicht gelesene Includes", as is a local include that is missing or leaves the repository. |
| `repo` manifests (an XML file whose `<manifest>` has `<project>` or `<include>` elements) | each `<project>`: URL from its remote's `fetch` and its name, revision from the project, else the remote, else `<default>`; a commit as revision takes the branch from `upstream` / `dest-branch`. `<include>`, `<extend-project>` and `<remove-project>` are followed (locally). A manifest with a DTD is not read. |
| `.gitmodules` | each submodule's URL and `branch`; for a git repository the commit its HEAD records for the submodule (the gitlink). An uploaded archive has no git history, so its submodules have no commit. A submodule's own kas files and manifests are not read as the tree's. |
Files over 1 MiB, symbolic links and YAML that expands past 100,000 nodes
through aliases are not read; kas files and manifests are looked for up to four
directories deep, not in `build/`, `downloads/` or vendor directories.
**The release** is read from the first of:
1. the branch or tag of the Poky, OpenEmbedded-Core or meta-openembedded pin
(in that order): a codename (`scarthgap`, `scarthgap-5.0.3`,
`kirkstone-4.0.15`, `dunfell-23.0.10`) or a `yocto-<version>` tag
(`yocto-5.0.3`); `master` names none;
2. `LAYERSERIES_COMPAT_core` of an OpenEmbedded-Core layer in the tree;
3. `LAYERSERIES_COMPAT_*` of your layers: the **newest** release all of them
declare. A layer compatible with `kirkstone scarthgap` may be built on
Scarthgap, so it is not reported as Kirkstone (the recipe lint reads the
oldest one instead, for the syntax the recipes must accept).
The pins win over `LAYERSERIES_COMPAT`: they say what the build fetches, the
layer what it claims to support. When none of the three names a release in the
table below, there is no finding and the run lists **Yocto-Release
(Support-Status)** under **Nicht ausgeführt**.
**Support status.** On the scan's date:
| Rule (`yocto-release`) | When | Severity | CRA | Control |
| --- | --- | --- | --- | --- |
| `yocto-release-eol` | the release's end of life has passed | high | Annex I Part I (2)(c) security updates, Part II (2) remediation without delay | CRA-AI-22 |
| `yocto-release-eol-soon` | its end of life is within six months (an LTS release) or two months (any other: a non-LTS release is supported for about seven months, so a longer window would warn from its first weeks) | medium | the same | CRA-AI-22 |
The finding names the release, its end of life, where it was read from (the
kas file, manifest or `layer.conf`) and the source of the date, and recommends
the current long term support release (the newest LTS supported for more than
six months on the scan's date). It is CWE-1104 (unmaintained third-party
components).
**The release table** (in `compliance-agent/src/pipeline/yocto_pins/release.rs`)
is taken from the [Yocto Project releases wiki](https://wiki.yoctoproject.org/wiki/Releases)
(page last updated 2026-09-10), checked on **2026-10-09**. The wiki gives
months; the exact days are [endoflife.date's](https://endoflife.date/yocto),
which match the wiki except Walnascar (wiki: "EOL since November 2025"). For
Thud and older the end of life is the month of the last point release.
| Codename | Version | LTS | Released | End of life |
| --- | --- | --- | --- | --- |
| Jethro … Thud | 2.0 – 2.6 | no | 2015 – 2018 | 2017 – 2019 |
| Warrior | 2.7 | no | 2019-05-01 | 2020-06-01 |
| Zeus | 3.0 | no | 2019-10-22 | 2020-08-01 |
| Dunfell | 3.1 | yes | 2020-04-21 | 2024-04-30 |
| Gatesgarth | 3.2 | no | 2020-11-03 | 2021-05-01 |
| Hardknott | 3.3 | no | 2021-04-19 | 2022-04-20 |
| Honister | 3.4 | no | 2021-10-25 | 2022-05-01 |
| Kirkstone | 4.0 | yes | 2022-04-25 | 2026-04-27 |
| Langdale | 4.1 | no | 2022-10-23 | 2023-05-27 |
| Mickledore | 4.2 | no | 2023-05-03 | 2023-11-05 |
| Nanbield | 4.3 | no | 2023-11-09 | 2024-06-09 |
| Scarthgap | 5.0 | yes | 2024-04-29 | 2028-04-30 |
| Styhead | 5.1 | no | 2024-10-16 | 2025-05-16 |
| Walnascar | 5.2 | no | 2025-05-07 | 2025-12-07 |
| Whinlatter | 5.3 | no | 2025-12-15 | 2026-06-15 |
| Wrynose | 6.0 | yes | 2026-05-13 | 2030-04-30 |
Blacksail (6.1, due October 2026) is not in the table until it is released; a
layer on it reads as an unknown release. The table is updated by hand with
each Yocto release.
## Recipe inventory
A tree detected as a Yocto layer tree (see [Detection](#detection)), and any
Yocto target, gets a recipe inventory. Each recipe is parsed
with [oelint-parser](https://github.com/priv-kweihmann/oelint-parser) together
with its `.bbappend` files; nothing in it is executed and nothing is built.
Image recipes, package groups and tools built only for the build host
(`-native`, `nativesdk-`, `-cross`) are not components and are left out.
| Component field | From the recipe |
|---|---|
| Name | the base recipe name (BPN) |
| Version | `PV`, else the version in the file name (`busybox_1.35.0.bb`); a git suffix is dropped (`1.0+git${SRCPV}` is `1.0`); with no version at all (`PV = "git"`), the `SRCREV` commit |
| Package URL | `pkg:github/<owner>/<repo>@<version>` for a source on GitHub, else `pkg:generic/<name>@<version>` with the `download_url` (a tarball) or `vcs_url` (a git repository at its `SRCREV`) |
| CPE | `cpe:2.3:a:<vendor or *>:<product>:<version>:…` from `CVE_PRODUCT` (`product` or `vendor:product`) and `CVE_VERSION`, else from the name and version |
| License | `LICENSE`, with Yocto's `&` and `\|` written as `AND` and `OR` |
**This is not the image's SBOM**, and the CRA view says so: the requirements
checked on a target's components (SBOM, known vulnerabilities) are
**Teilweise bewertet** (*partly assessed*, "recipe inventory only, not the
image SBOM") until an image SBOM can be imported (tier 2). Layer overrides between layers,
`PACKAGECONFIG` and the distro and machine configuration are not resolved, so
the inventory lists every recipe in the tree: more than an image contains, and
nothing from layers that are not in the tree. The recipes an image recipe names
are marked, see [Im Image (deklariert)](#im-image-deklariert). The components say so wherever they appear: the **Yocto-Rezept** badge in
the SBOM view, the component property `pruefwerk:component:source` in the
CycloneDX export and the package `comment` in the SPDX export (both read
"Yocto recipe inventory (not the image SBOM)"), and the component's evidence
line naming the recipe and its `.bbappend` files.
**CVEs.** The recipes are matched in NVD by CPE, every product of
`CVE_PRODUCT` (or the recipe name, as Yocto's cve-check does) against
`CVE_VERSION` (or the version). A recipe with only local `file://` sources and
no `CVE_PRODUCT` is the product's own code and is not looked up. A recipe
without a release version, a failed lookup, and recipes the scan's NVD time
budget (10 minutes) did not reach are listed under **CVE-Abgleich
unvollständig**. The requests are paced to NVD's rate limit: 50 per 30 seconds
with the deployment's NVD API key, 5 without; an answer from the last 6 hours
is reused, so the next scan gets further. Between scans the CVE monitor
re-checks the recipes too (see
[Known vulnerabilities](/guide/sbom#known-vulnerabilities)): a CVE NVD
publishes or changes for a recipe's product raises an alert without a new
scan.
**What the recipe says about a CVE becomes its VEX statement**, made by the
scan, with the recipe (or patch) and its text as the impact statement, so it is
in the OpenVEX, CycloneDX VEX and CSAF exports (see
[SBOM & Licenses](/guide/sbom#vex-the-status-of-each-vulnerability)):
| In the recipe | VEX statement |
|---|---|
| a patch in `SRC_URI` with a `CVE:` tag (or the CVE id in its file name) | `fixed` |
| `CVE_STATUS` `backported-patch`, `cpe-stable-backport`, `fixed-version` | `fixed` |
| `CVE_STATUS` `cpe-incorrect` | `not_affected`, `component_not_present` |
| `CVE_STATUS` `not-applicable-platform`, `not-applicable-config` | `not_affected`, `vulnerable_code_not_present` |
| `CVE_STATUS` `upstream-wontfix`, `disputed`, `ignored` (and the older `CVE_CHECK_IGNORE`) | `under_investigation` (CycloneDX `in_triage`), the reason as the status note: setting a CVE aside says nothing on whether the product is affected |
| `CVE_STATUS` `unpatched`, `vulnerable-investigation` | none: the alert stays to be assessed |
In the OpenVEX export the note of an `under_investigation` or `fixed`
statement is its `status_notes`, in CSAF an `impact` threat, in CycloneDX the
analysis `detail`. `CVE_STATUS_GROUPS` count like single `CVE_STATUS` flags. The scan states them
again on every scan and withdraws one the recipe no longer makes; a statement
a person made is never replaced.
## Im Image (deklariert)
The inventory keeps every recipe, but marks those your image recipes say they
install: **Im Image (deklariert)** (*In the image (declared)*). It is read from
the recipes as they are written, with the same parser and without a build; it
is what the image recipes declare, not what BitBake would resolve.
**What is read.** Image recipes are the `.bb` files that inherit `core-image`,
`image` (or another image class) or set `IMAGE_INSTALL` / `IMAGE_FEATURES`,
files named `*-image*.bb` that declare what to install, and a `*-image*.bbappend`
of an image that is not in the tree (`core-image-minimal.bbappend`). From them,
and from every `conf/local.conf.sample` and `conf/distro/*.conf`:
- `IMAGE_INSTALL` and `CORE_IMAGE_EXTRA_INSTALL` with every operation: `=`,
`?=`, `+=`, `:append` and the older `_append`, `:remove`;
- `IMAGE_FEATURES` and `EXTRA_IMAGE_FEATURES`.
A local.conf.sample or distro configuration counts for every image recipe in
the tree (with none, the component names the configuration file instead).
**How a name becomes a recipe.**
| The image names | Marked |
|---|---|
| a recipe (`busybox`) | that recipe |
| a package a recipe's `PACKAGES` names (`pump-web-ui`) | that recipe |
| a default package (`busybox-dev`, `-dbg`, `-doc`, `-locale`, `-src`, `-staticdev`, `-ptest`) | its recipe |
| a package group in the tree (`packagegroup-pump`) | what that package's `RDEPENDS` and `RRECOMMENDS` name, one level: a package group inside it is not expanded |
| an image feature (`ssh-server-dropbear`) | its package group from OpenEmbedded-Core's `FEATURE_PACKAGES_*` (`packagegroup-core-ssh-dropbear`), if that package group is in the tree |
**Where it shows.** A badge **Im Image (deklariert)** next to the component in
the SBOM view, whose tooltip names the images and says it is read from the
recipes, not resolved by bitbake; a filter of the same name; and the SBOM list
puts these components first. The component's evidence line names the images,
the CycloneDX export carries the property `pruefwerk:component:in_image`
(`declared: pump-image`), and the SPDX export adds it to the package `comment`.
What an image names that is neither a recipe nor a package group in the tree
(`packagegroup-core-boot` from Poky, a feature whose package group is not in
the tree, a feature such as `splash` whose packages a variable chooses) is
listed on the run under **Im Image (deklariert)**; no component is invented for
it.
**What is not resolved.** Overrides (`IMAGE_INSTALL:append:qemux86` counts as
if it applied to every machine), `PACKAGECONFIG`, installs that depend on
`DISTRO_FEATURES` or other inline Python (a package only one branch of
`${@bb.utils.contains(...)}` names is left out; the Python is never run), variables the tree does not set (`${CORE_IMAGE_BASE_INSTALL}`), package
groups more than one level deep, `RPROVIDES` and virtual packages, a
`FEATURE_PACKAGES_*` of your own, `BAD_RECOMMENDATIONS`, and which distro a
build selects (every distro configuration counts). Nothing is built, and no
recipe from a layer that is not in the tree is marked. The CRA state of the
SBOM requirement stays **Teilweise bewertet** until an image SBOM from a build
can be imported (tier 2).
## What is planned
| Tier | Input | Analysis |
| --- | --- | --- |
| **1: layer tree** (in progress) | the layers in git, no build | **Recipe inventory**: every recipe's name, version, `SRC_URI`, `CVE_PRODUCT` and `CVE_STATUS`, matched against NVD; labelled as a recipe inventory, not the image's SBOM; the recipes an image recipe installs marked as declared. **Recipe lint**: done, see above |
| **2: build artefacts** | `tmp/deploy/spdx` (SPDX 3.0, or 2.2 up to Scarthgap), `*.vex.json`, the image `.manifest`, the kernel `.config` | **SPDX import** into the SBOM view and CycloneDX export; **sbom-cve-check** with the Yocto VEX annotations; kernel CVEs filtered by the configuration; a nightly re-check without a rebuild |
| **3: image / rootfs** | `.wic`, tar, ext4, squashfs | unpacking, ELF hardening of every binary, secrets and default credentials in the root filesystem; DAST and pentest only for a qemu build in an isolated sandbox |