feat(control-map): a missing Content-Security-Policy is evidence for cra-ai-1 (#998) (#1011)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Dashboard (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m9s
CI / Deploy Agent (push) Successful in 6m12s
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Dashboard (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m9s
CI / Deploy Agent (push) Successful in 6m12s
This commit was merged in pull request #1011.
This commit is contained in:
1 parent
98be82c0d0
commit
246e2c4ac5
3 files changed
+40
-3
No files matched your search
@@ -137,6 +137,18 @@
|
||||
"yocto-local-conf-no-security-flags"
|
||||
],
|
||||
"check": "The image's shipped configuration must be secure by default: an sshd_config that permits root or password logins, or a distro built without security_flags.inc (stack protector, FORTIFY_SOURCE, PIE, RELRO), violates it."
|
||||
},
|
||||
{
|
||||
"tool": "dast",
|
||||
"scan_type": "dast",
|
||||
"languages": [],
|
||||
"cwe": [
|
||||
"CWE-16",
|
||||
"CWE-693"
|
||||
],
|
||||
"rules": [],
|
||||
"check": "The running application leaves a browser protection off by default: a missing or weak Content-Security-Policy or another missing security header on what it serves.",
|
||||
"attach_only": true
|
||||
}
|
||||
],
|
||||
"note": null,
|
||||
|
||||
+27
-3
@@ -231,6 +231,29 @@ mod tests {
|
||||
assert!(map.controls_for_cwe("CWE-0").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_missing_content_security_policy_is_evidence_for_secure_defaults() {
|
||||
// DAST reports a missing CSP as CWE-16 and a missing protection
|
||||
// mechanism as CWE-693 (#998). Neither makes the control count as
|
||||
// checked: the DAST checks look at what one URL serves.
|
||||
let map = ControlMap::cra().expect("map");
|
||||
for cwe in ["CWE-16", "CWE-693"] {
|
||||
let ids: Vec<&str> = map
|
||||
.controls_for_cwe(cwe)
|
||||
.iter()
|
||||
.map(|c| c.control.as_str())
|
||||
.collect();
|
||||
assert_eq!(ids, ["cra-ai-1"], "{cwe}");
|
||||
}
|
||||
let dast = map
|
||||
.coverage("cra-ai-1")
|
||||
.and_then(|c| c.scans.iter().find(|s| s.tool == "dast"))
|
||||
.expect("a dast binding");
|
||||
assert!(dast.attach_only);
|
||||
// So the CRA status never reads "checked" because of it.
|
||||
assert!(!dast.applies_to(&["python".to_string()]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cra_map_loads_all_40_controls() {
|
||||
let map = ControlMap::cra().expect("CRA map should parse");
|
||||
@@ -306,14 +329,15 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn every_code_binding_names_its_languages() {
|
||||
// Only tools that do not read source code may be language-independent;
|
||||
// a rule binding without languages would claim every language.
|
||||
// Only tools that do not read source code may be language-independent
|
||||
// (DAST tests the running application); a rule binding without
|
||||
// languages would claim every language.
|
||||
let map = ControlMap::cra().expect("map");
|
||||
for control in &map.controls {
|
||||
for scan in &control.scans {
|
||||
let reads_code = !matches!(
|
||||
scan.tool.as_str(),
|
||||
"gitleaks" | "secret-files" | "syft" | "osv" | "binary-inventory"
|
||||
"gitleaks" | "secret-files" | "syft" | "osv" | "binary-inventory" | "dast"
|
||||
);
|
||||
assert_eq!(
|
||||
reads_code,
|
||||
|
||||
Reference in new issue
Block a user