feat(yocto): recipes are checked with oelint-adv and our own secure-by-default rules (#552)
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

This commit was merged in pull request #552.
This commit is contained in:
sharang committed 2026-10-09 15:48:31 +00:00
1 parent 750f1d7308
commit 7e3856db31
25 files changed
+2017 -28

No files matched your search

+43
View File
@@ -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();