Files
pruefwerk/docs/guide/yocto.md
T
sharang 7e3856db31
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 6s
CI / Deploy Docs (push) Successful in 1m32s
CI / Deploy MCP (push) Successful in 5m11s
CI / Deploy Agent (push) Successful in 13m11s
CI / Deploy Dashboard (push) Successful in 16m16s
feat(yocto): recipes are checked with oelint-adv and our own secure-by-default rules (#552)
2026-10-09 15:48:31 +00:00

6.4 KiB

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
Recipe inventory in progress (tier 1), listed under Nicht ausgeführt until it lands
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-6
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. 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-6
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".

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. 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