feat(yocto): recipes are checked with oelint-adv and our own secure-by-default rules
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) Failing after 2m11s
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) Failing after 2m11s
Recipe lint over a Yocto layer tree, without a build: - oelint-adv 9.11.2 (BSD-2-Clause, pinned in the agent image) runs with a rule file holding only its security rules (bad image features, missing checksums, AUTOREV, git tags, network tasks, INSANE_SKIP), with an empty environment, OELINT_SKIP_CONFIG and a 10-minute timeout. Each layer is read with the oldest release its LAYERSERIES_COMPAT names. A run that does not complete is recorded as the skipped stage recipe_lint. - Our own rules (yocto-config): passwords in EXTRA_USERS_PARAMS (value hidden), http:// in SRC_URI, PermitRootLogin/PasswordAuthentication yes in a shipped sshd_config, certificates shipped with a recipe (info), and a distro or local.conf.sample without security_flags.inc (following require/include). - Upstream layers (Poky, OpenEmbedded, BSP vendors, by BBFILE_COLLECTIONS) are not linted and are named as a skipped stage. - Findings carry the type recipe_lint, the CRA Annex I requirement, and bind by rule id to cra-ai-1, cra-ai-8 and cra-ai-6 in the control map; .bb files count as the language bitbake, so those controls can be assessed. - The scan matrix turns recipe_lint on; the dashboard lists the type in the findings filter and names both tools; docs list the rules; the nightly fixture gains an insecure image, recipes, distro and sshd_config. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
1 parent
750f1d7308
commit
a50fdf44e8
25 files changed
+2003
-28
No files matched your search
@@ -30,6 +30,7 @@ For the **CRA** framework (40 controls) the split is **21 covered · 0 needs_too
|
||||
- **Vendored semgrep packs** (GitLab, 0xdea, elttam; #492), bound **by CWE** like off-the-shelf tools, on a semgrep binding of their own per control whose `languages` are exactly those of the vendored rules under those CWEs (a test checks every vendored rule maps to a control that claims its languages). The few elttam rules without a CWE are bound by rule id. Because these bindings are `semgrep` bindings, a CWE they list also attaches our own semgrep findings with that CWE to the control.
|
||||
- **mobsfscan** for Android and iOS apps, bound **by CWE** (a mobsfscan binding only ever attaches mobsfscan findings): `cra-ai-1` (debuggable, exported components, outdated `minSdkVersion`), `7`, `8`, `9`, `13`, `14`, `15` (cleartext, TLS, App Transport Security), `16` and `20`. Each binding lists only the languages mobsfscan has rules for under those CWEs, so `cra-ai-1` covers Java and Kotlin (its manifest checks) but not Swift.
|
||||
- **DevSkim** for C# and VB.NET (#494), bound **by CWE** (each DevSkim rule gets its CWE in `pipeline/devskim.rs`; its SARIF carries none): `cra-ai-1` (tracing), `8`, `10` (cookies without Secure), `13`, `14` (DPAPI without entropy), `15`, `16` and `20` (deserialisation, XXE).
|
||||
- **Yocto recipe lint** (oelint-adv and our `yocto-config` rules), bound **by rule id** with the language `bitbake`: `cra-ai-1` (debug and root-login image features, sshd root/password logins, a distro without `security_flags.inc`), `cra-ai-8` (empty-password image features, passwords in `EXTRA_USERS_PARAMS`) and `cra-ai-6` (downloads without a checksum, `AUTOREV`, git tags, network access in tasks, `http://` fetches). The attack-surface rules (network tasks, `http://`) bind to `cra-ai-6` because `cra-ai-2` stays not code-checkable.
|
||||
- **8 grounded surface checks** (`cra-ai-6`, `11`, `12`, `24`, `27`, `28`, `29`, `30`): the absence-based controls (no rate limiting, no security logging, no update-signature check…) that have no syntactic pattern.
|
||||
- **Marked not_code_checkable** (`cra-ai-2`, `3`, `4`, `5`, among the 19): minimal attack surface, secure architecture, least privilege, tamper protection.
|
||||
|
||||
@@ -37,7 +38,7 @@ For the **CRA** framework (40 controls) the split is **21 covered · 0 needs_too
|
||||
|
||||
Each binding in the control map names the **languages** its rules run on (`languages`, empty for language-independent tools such as gitleaks, syft and osv). A test keeps these in step with the rule pack. Each scan run records the source languages it saw outside vendor code (`ScanRun.languages`).
|
||||
|
||||
The CRA status calls a covered control **"no violation found"** only when one of its bindings applies to those languages *and* no tool it relies on failed in that scan (a skipped `sast`, `sast_c_cpp`, `sast_mobile`, `sast_dotnet` or `cve_lookup` stage). Otherwise the control is **not assessed**, with the reason: not scanned yet, no rule for the languages found, a tool that did not complete, or languages unknown (a run from before they were recorded). A C-only firmware repo therefore never reads "no violation found" for controls only Python rules check (#368, #387).
|
||||
The CRA status calls a covered control **"no violation found"** only when one of its bindings applies to those languages *and* no tool it relies on failed in that scan (a skipped `sast`, `sast_c_cpp`, `sast_mobile`, `sast_dotnet`, `recipe_lint` or `cve_lookup` stage). Otherwise the control is **not assessed**, with the reason: not scanned yet, no rule for the languages found, a tool that did not complete, or languages unknown (a run from before they were recorded). A C-only firmware repo therefore never reads "no violation found" for controls only Python rules check (#368, #387).
|
||||
|
||||
At scale, the **master-controls** corpus (breakpilot's deduped clusters, exported as OSCAL) currently provides **~2,882 code-checkable controls** (2,143 `network` + 739 `source_code`), matched semantically.
|
||||
|
||||
|
||||
+51
-2
@@ -36,15 +36,64 @@ searched.
|
||||
| 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 inventory, recipe lint | in progress (tier 1), listed under **Nicht ausgeführt** until they land |
|
||||
| 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 neither requires `security_flags.inc` nor a Poky distro or include that does | 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 cannot be followed, so such a
|
||||
distro is not reported.
|
||||
|
||||
**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**: oelint-adv plus our own rules (debug and empty-password image features, `http://` fetches, keys under `files/`, missing `security_flags.inc`) |
|
||||
| **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 |
|
||||
@@ -79,6 +79,21 @@ a `.mobsf` file from your repository, and skips `Pods/`, `build/`, `.gradle/`,
|
||||
`DerivedData/`, `Carthage/` and `node_modules/`. Its findings are
|
||||
**Codeanalyse (SAST)** findings with the tool name `mobsfscan`.
|
||||
|
||||
## oelint-adv and our rules -- Yocto Layers
|
||||
|
||||
On trees with BitBake recipes (`.bb`, `.bbappend`, `.bbclass`),
|
||||
[oelint-adv](https://github.com/priv-kweihmann/oelint-adv) (BSD-2-Clause, used
|
||||
unchanged) runs with its security rules only: debug and empty-password image
|
||||
features, downloads without a checksum, `AUTOREV`, git tags instead of commits,
|
||||
network access in tasks, skipped QA checks. Our own rules (`yocto-config`) add
|
||||
passwords in `EXTRA_USERS_PARAMS`, `http://` fetches, a shipped `sshd_config`
|
||||
allowing root or password logins, certificates shipped with a recipe, and a
|
||||
distro without `security_flags.inc`. oelint-adv never reads a `.oelint.cfg` from
|
||||
your repository; upstream layers (Poky, OpenEmbedded, BSP vendors) are not
|
||||
linted. Findings are **Rezept-Prüfung (Yocto)** findings with the tool name
|
||||
`oelint-adv` or `yocto-config`; the rule list is in [Embedded Linux /
|
||||
Yocto](../guide/yocto.md#recipe-lint).
|
||||
|
||||
### iOS app settings
|
||||
|
||||
Prüfwerk reads every `Info.plist` and the `INFOPLIST_KEY_*` build settings of
|
||||
|
||||
Reference in new issue
Block a user