feat(yocto): layer trees are detected as Embedded Linux / Yocto, and the scan matrix says what runs #550

Merged
sharang merged 1 commits from feat/yocto-detection-matrix into main 2026-10-09 14:58:09 +00:00
Owner

Yocto tier 1, part 1: detection plus the scan matrix. The recipe inventory (SBOM/CVE) and the recipe lint come in follow-up PRs.

Detection

classify/language.rs recognises a Yocto / OpenEmbedded layer tree (EmbeddedLinuxYocto):

Signal Confidence
conf/layer.conf + recipes (*.bb, *.bbappend, *.inc beside recipes-*) 0.8
only one of them 0.65
kas file (kas*.yml, kas/*.yml) 0.6
bblayers.conf / local.conf / oe-init-build-env 0.5

meta-* dirs (except META-INF) and distro/*.conf add +0.05 to a weaker verdict and never decide on their own. A layer with C sources in files/ stays Yocto: 0.8 beats Firmwerk's source-archaeology (0.3) and Make (0.6). A vendored Zephyr/ESP-IDF tree (Firmwerk high, 0.9) still wins, on purpose.

Signal for the inventory stage: classification facts build_system = bitbake (source heuristic) and one yocto_layer = <dir> per layer (the directory holding conf/layer.conf, . for the root, at most 10). Gate on classification.suggested == EmbeddedLinuxYocto or on those facts.

Limits: the wizard's detect endpoint classifies from artifact kinds only (no ingest), so the type is proposed after the first scan, the same as Android/.NET. A build/ directory is not searched (SKIPPED_DIRS).

Scan matrix (compliance-core/src/scan_matrix.rs)

  • New ScanType::RecipeInventory (recipe_inventory) and ScanType::RecipeLint (recipe_lint). For Yocto they are bound to code and are unavailable for now. To turn one on, change one line: set RECIPE_INVENTORY / RECIPE_LINT to None. Until then each Yocto scan records them under "Nicht ausgeführt".
  • Image SBOM/CVE: "needs build artefacts (SPDX/manifest), planned".
  • Pentest is off for Yocto (supports_pentest). DAST stays opt-in with an http(s) URL.
  • Dashboard: it reads the matrix generically, but labels and purposes are exhaustive per ScanType. I added DE/EN labels, purposes, stage labels and coverage::reason texts for the new reasons, plus test cases. SCAN_TYPES (the findings filter) is unchanged, because neither stage produces findings yet.

Firmware SBOM

The orchestrator no longer runs Firmwerk on a tree classified as Yocto (it would read the recipe's C sources as a bare-metal project). It records firmware_sbom as NotAnalysedYet with "Yocto build analysis is planned (tier 2)" (scan_matrix::YOCTO_BUILD_PLANNED), translated in the dashboard.

Fixture / nightly

fw-yocto-layer: the name no longer says "(unsupported)". New expectation detected_facts: {build_system: bitbake, yocto_layer: "."}. The baseline's skipped_stages gains recipe_inventory and recipe_lint, because the matrix now records them. The inventory PR removes recipe_inventory from that list when it flips it on. SBOM/CVE expectations are untouched.

Docs

New docs/guide/yocto.md (detection, what runs today, tiers 1-3), linked in the sidebar and in repositories.md.

Tests

  • language: a_layer_with_recipes_is_confidently_yocto_and_names_its_layers, weaker_yocto_signals_give_a_lower_confidence, meta_inf_and_loose_conf_files_are_not_yocto
  • classify: the_nightly_yocto_fixture_is_typed_yocto, a_plain_c_firmware_repo_stays_bare_metal, a_layer_shipping_c_sources_is_yocto_not_bare_metal
  • matrix: a_yocto_layer_tree_lists_the_planned_recipe_stages_and_runs_its_source_scans, a_yocto_image_has_no_sbom_until_build_artefacts_can_be_imported, pentest_support_matches_reachable_families (flipped)
  • plan: a_yocto_layer_tree_runs_its_source_scans_and_records_the_planned_recipe_stages
  • dashboard: coverage_tests extended

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Yocto tier 1, part 1: detection plus the scan matrix. The recipe inventory (SBOM/CVE) and the recipe lint come in follow-up PRs. ## Detection `classify/language.rs` recognises a Yocto / OpenEmbedded layer tree (`EmbeddedLinuxYocto`): | Signal | Confidence | |---|---| | `conf/layer.conf` + recipes (`*.bb`, `*.bbappend`, `*.inc` beside `recipes-*`) | 0.8 | | only one of them | 0.65 | | kas file (`kas*.yml`, `kas/*.yml`) | 0.6 | | `bblayers.conf` / `local.conf` / `oe-init-build-env` | 0.5 | `meta-*` dirs (except `META-INF`) and `distro/*.conf` add +0.05 to a weaker verdict and never decide on their own. A layer with C sources in `files/` stays Yocto: 0.8 beats Firmwerk's source-archaeology (0.3) and Make (0.6). A vendored Zephyr/ESP-IDF tree (Firmwerk high, 0.9) still wins, on purpose. **Signal for the inventory stage:** classification facts `build_system = bitbake` (source `heuristic`) and one `yocto_layer = <dir>` per layer (the directory holding `conf/layer.conf`, `.` for the root, at most 10). Gate on `classification.suggested == EmbeddedLinuxYocto` or on those facts. Limits: the wizard's `detect` endpoint classifies from artifact kinds only (no ingest), so the type is proposed after the first scan, the same as Android/.NET. A `build/` directory is not searched (`SKIPPED_DIRS`). ## Scan matrix (`compliance-core/src/scan_matrix.rs`) - New `ScanType::RecipeInventory` (`recipe_inventory`) and `ScanType::RecipeLint` (`recipe_lint`). For Yocto they are bound to code and are unavailable for now. **To turn one on, change one line:** set `RECIPE_INVENTORY` / `RECIPE_LINT` to `None`. Until then each Yocto scan records them under "Nicht ausgeführt". - Image SBOM/CVE: "needs build artefacts (SPDX/manifest), planned". - Pentest is off for Yocto (`supports_pentest`). DAST stays opt-in with an http(s) URL. - Dashboard: it reads the matrix generically, but labels and purposes are exhaustive per `ScanType`. I added DE/EN labels, purposes, stage labels and `coverage::reason` texts for the new reasons, plus test cases. `SCAN_TYPES` (the findings filter) is unchanged, because neither stage produces findings yet. ## Firmware SBOM The orchestrator no longer runs Firmwerk on a tree classified as Yocto (it would read the recipe's C sources as a bare-metal project). It records `firmware_sbom` as NotAnalysedYet with "Yocto build analysis is planned (tier 2)" (`scan_matrix::YOCTO_BUILD_PLANNED`), translated in the dashboard. ## Fixture / nightly `fw-yocto-layer`: the name no longer says "(unsupported)". New expectation `detected_facts: {build_system: bitbake, yocto_layer: "."}`. The baseline's `skipped_stages` gains `recipe_inventory` and `recipe_lint`, because the matrix now records them. The inventory PR removes `recipe_inventory` from that list when it flips it on. SBOM/CVE expectations are untouched. ## Docs New `docs/guide/yocto.md` (detection, what runs today, tiers 1-3), linked in the sidebar and in `repositories.md`. ## Tests - language: `a_layer_with_recipes_is_confidently_yocto_and_names_its_layers`, `weaker_yocto_signals_give_a_lower_confidence`, `meta_inf_and_loose_conf_files_are_not_yocto` - classify: `the_nightly_yocto_fixture_is_typed_yocto`, `a_plain_c_firmware_repo_stays_bare_metal`, `a_layer_shipping_c_sources_is_yocto_not_bare_metal` - matrix: `a_yocto_layer_tree_lists_the_planned_recipe_stages_and_runs_its_source_scans`, `a_yocto_image_has_no_sbom_until_build_artefacts_can_be_imported`, `pentest_support_matches_reachable_families` (flipped) - plan: `a_yocto_layer_tree_runs_its_source_scans_and_records_the_planned_recipe_stages` - dashboard: `coverage_tests` extended 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-09 14:48:04 +00:00
feat(yocto): layer trees are detected as Embedded Linux / Yocto, and the scan matrix says what runs
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 9m1s
e4685ebc84
- Heuristic classifier recognises a Yocto layer tree: conf/layer.conf with
  recipes 0.8, one of them 0.65, kas file 0.6, build conf / oe-init-build-env
  0.5 (meta-* / distro confs only corroborate). Facts: build_system=bitbake,
  yocto_layer=<dir> per layer. Outranks Firmwerk's source archaeology on
  C sources in files/.
- Scan matrix: new RecipeInventory / RecipeLint scan types, planned (flip by
  setting RECIPE_INVENTORY / RECIPE_LINT to None); image SBOM/CVE need build
  artefacts; no pentest for Yocto.
- Firmware SBOM is not run on a Yocto tree; recorded as "Yocto build
  analysis is planned (tier 2)".
- Dashboard texts (de/en), docs/guide/yocto.md, nightly fixture expectation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang force-pushed feat/yocto-detection-matrix from 1a068dd1fb to e4685ebc84 2026-10-09 14:48:04 +00:00 Compare
sharang merged commit 750f1d7308 into main 2026-10-09 14:58:09 +00:00
Sign in to join this conversation.