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
@@ -337,6 +337,49 @@ mod tests {
|
||||
assert!(c.checked_for(&["python".to_string()]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn yocto_recipe_findings_attach_to_their_controls() {
|
||||
let map = ControlMap::cra().expect("map");
|
||||
let controls = |tool: &str, rule: &str| -> Vec<&str> {
|
||||
map.controls_for_finding(tool, None, Some(rule))
|
||||
.into_iter()
|
||||
.map(|c| c.control.as_str())
|
||||
.collect()
|
||||
};
|
||||
let debug = "oelint.var.badimagefeature.debug-tweaks";
|
||||
assert_eq!(controls("oelint-adv", debug), ["cra-ai-1", "cra-ai-8"]);
|
||||
assert_eq!(
|
||||
controls("oelint-adv", "oelint.var.badimagefeature.tools-debug"),
|
||||
["cra-ai-1"]
|
||||
);
|
||||
for rule in [
|
||||
"oelint.vars.srcurichecksum",
|
||||
"oelint.vars.autorev",
|
||||
"oelint.vars.srcurigittag",
|
||||
"oelint.task.network",
|
||||
] {
|
||||
assert_eq!(controls("oelint-adv", rule), ["cra-ai-6"], "{rule}");
|
||||
}
|
||||
assert!(controls("oelint-adv", "oelint.vars.insaneskip").is_empty());
|
||||
assert_eq!(
|
||||
controls("yocto-config", "yocto-extrausers-password"),
|
||||
["cra-ai-8"]
|
||||
);
|
||||
assert_eq!(controls("yocto-config", "yocto-src-uri-http"), ["cra-ai-6"]);
|
||||
assert_eq!(
|
||||
controls("yocto-config", "yocto-sshd-root-login"),
|
||||
["cra-ai-1"]
|
||||
);
|
||||
assert!(controls("yocto-config", "yocto-files-certificate").is_empty());
|
||||
// A rule id of one tool does not attach a finding of another.
|
||||
assert!(controls("semgrep", debug).is_empty());
|
||||
// A layer tree is checked for these controls.
|
||||
let bitbake = ["bitbake".to_string()];
|
||||
for id in ["cra-ai-1", "cra-ai-6", "cra-ai-8"] {
|
||||
assert!(map.coverage(id).expect(id).checked_for(&bitbake), "{id}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hardcoded_password_control_is_tool_covered() {
|
||||
let map = ControlMap::cra().unwrap();
|
||||
|
||||
Reference in new issue
Block a user