story 2-10-security-schemes-secrets: implemented and reviewed via bmad-loop
This commit is contained in:
1 parent
f5f40cb167
commit
ecfb4e788f
45 files changed
+6025
-829
No files matched your search
@@ -14405,16 +14405,9 @@
|
||||
"GET /secure"
|
||||
],
|
||||
"warning_findings": [],
|
||||
"blocker_findings": [
|
||||
{
|
||||
"code": "unsupported_security_requirement",
|
||||
"severity": "Error",
|
||||
"operation_key": "GET /secure",
|
||||
"location": "/security/0"
|
||||
}
|
||||
]
|
||||
"blocker_findings": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"compatibility_impact": "Corpus 1.0.3 adds hostile-security-scope.json: an effective-security-scope fixture showing that a document-level requirement blocks only the inherited candidate (GET /secure, location /security/0) while the public candidate with an explicit security: [] stays actionable and no document-global blocker is produced; all 50 representative previews and the previous hostile oracles are unchanged."
|
||||
"compatibility_impact": "Corpus 1.0.3 adds hostile-security-scope.json: an effective-security-scope fixture showing that a document-level basic requirement remains selectable on the inherited candidate (GET /secure, location /security/0) while the public candidate with an explicit security: [] stays public; malformed or unsupported requirements retain scoped blockers."
|
||||
}
|
||||
@@ -172,53 +172,63 @@ fn ac_1_support_matrix_rows_have_exact_construct_contracts() {
|
||||
"paths":{"/probe":{"get":{"security":[{"probe":[]}],"operationId":"securityProbe","responses":{"200":{"description":"ok"}}}}}
|
||||
})
|
||||
};
|
||||
assert_eq!(
|
||||
row["status"], "unsupported",
|
||||
"security is not yet persisted as Auth Profile semantics"
|
||||
);
|
||||
let source = serde_json::to_string(&probe).unwrap();
|
||||
let ir = normalize(&source).unwrap();
|
||||
validate_normalized_ir(&ir).unwrap();
|
||||
let expected_finding = row["expected_finding"].as_str().unwrap();
|
||||
let requirement = ir
|
||||
.findings
|
||||
.iter()
|
||||
.find(|finding| {
|
||||
finding.code == expected_finding
|
||||
&& finding.severity == crank_import::rest::ImportFindingSeverity::Error
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
panic!(
|
||||
"{version} {construct} must be explicitly blocked: {:?}",
|
||||
ir.findings
|
||||
)
|
||||
});
|
||||
assert_eq!(
|
||||
requirement.operation_key.as_deref(),
|
||||
Some("GET /probe"),
|
||||
"{version} {construct} blocker must belong to the affected candidate"
|
||||
);
|
||||
assert_eq!(
|
||||
requirement.location.pointer, "/paths/~1probe/get/security/0",
|
||||
"{version} {construct} blocker must point at the local requirement"
|
||||
);
|
||||
let preview = preview_from_ir(&ir);
|
||||
let candidate = &preview.groups[0].operations[0];
|
||||
assert!(
|
||||
candidate
|
||||
let requirement = &ir.operations[0].security_requirements.alternatives[0];
|
||||
if expected_finding == "none" {
|
||||
assert!(
|
||||
requirement.supported,
|
||||
"{version} {construct} is not selectable"
|
||||
);
|
||||
assert!(
|
||||
candidate.findings.iter().all(|finding| {
|
||||
finding.severity != crank_import::rest::ImportFindingSeverity::Error
|
||||
}),
|
||||
"{version} {construct} unexpectedly blocked: {:?}",
|
||||
candidate.findings
|
||||
);
|
||||
assert!(ir.security_schemes.contains_key("probe"));
|
||||
assert!(
|
||||
ir.coverage.iter().any(|entry| {
|
||||
entry.location.pointer == "/paths/~1probe/get/security/0"
|
||||
&& entry.disposition == CoverageDisposition::Mapped
|
||||
}),
|
||||
"{version} {construct} requirement has no mapped source coverage"
|
||||
);
|
||||
} else {
|
||||
let finding = ir
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == expected_finding
|
||||
&& finding.severity == crank_import::rest::ImportFindingSeverity::Error),
|
||||
"{version} {construct} candidate must be blocked: {:?}",
|
||||
candidate.findings
|
||||
);
|
||||
assert!(
|
||||
ir.coverage.iter().any(|entry| entry.location.pointer
|
||||
== "/paths/~1probe/get/security/0"
|
||||
&& entry.disposition == CoverageDisposition::Finding),
|
||||
"{version} {construct} has no finding coverage"
|
||||
);
|
||||
.chain(
|
||||
ir.operations
|
||||
.iter()
|
||||
.flat_map(|operation| operation.findings.iter()),
|
||||
)
|
||||
.find(|finding| {
|
||||
finding.code == expected_finding
|
||||
&& finding.severity == crank_import::rest::ImportFindingSeverity::Error
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
panic!("{version} {construct} missing blocker: {:?}", ir.findings)
|
||||
});
|
||||
assert_eq!(finding.operation_key.as_deref(), Some("GET /probe"));
|
||||
assert_eq!(finding.location.pointer, "/paths/~1probe/get/security");
|
||||
assert!(
|
||||
candidate
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == expected_finding
|
||||
&& finding.severity
|
||||
== crank_import::rest::ImportFindingSeverity::Error)
|
||||
);
|
||||
assert!(ir.coverage.iter().any(|entry| entry.location.pointer
|
||||
== "/paths/~1probe/get/security"
|
||||
&& entry.disposition == CoverageDisposition::Finding));
|
||||
}
|
||||
probed(&construct);
|
||||
}
|
||||
{
|
||||
@@ -301,23 +311,21 @@ fn ac_1_support_matrix_rows_have_exact_construct_contracts() {
|
||||
.unwrap()["expected_finding"]
|
||||
.as_str()
|
||||
.unwrap();
|
||||
let requirements = ir
|
||||
.findings
|
||||
assert_eq!(expected_finding, "none");
|
||||
let secured_operation = ir
|
||||
.operations
|
||||
.iter()
|
||||
.filter(|finding| finding.code == expected_finding)
|
||||
.collect::<Vec<_>>();
|
||||
.find(|operation| operation.key == "GET /secured")
|
||||
.unwrap();
|
||||
assert!(secured_operation.security_requirements.alternatives[0].supported);
|
||||
assert_eq!(
|
||||
requirements.len(),
|
||||
1,
|
||||
"exactly the inherited operation must be blocked: {:?}",
|
||||
requirements
|
||||
secured_operation.security_requirements.alternatives[0]
|
||||
.source_location
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.pointer,
|
||||
"/security/0"
|
||||
);
|
||||
assert_eq!(
|
||||
requirements[0].operation_key.as_deref(),
|
||||
Some("GET /secured"),
|
||||
"blocker must belong only to the affected candidate"
|
||||
);
|
||||
assert_eq!(requirements[0].location.pointer, "/security/0");
|
||||
let preview = preview_from_ir(&ir);
|
||||
let mut by_key = std::collections::BTreeMap::new();
|
||||
for group in &preview.groups {
|
||||
@@ -342,17 +350,17 @@ fn ac_1_support_matrix_rows_have_exact_construct_contracts() {
|
||||
secured
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == expected_finding
|
||||
&& finding.severity == crank_import::rest::ImportFindingSeverity::Error),
|
||||
"secured operation must be blocked: {:?}",
|
||||
.all(|finding| finding.severity
|
||||
!= crank_import::rest::ImportFindingSeverity::Error),
|
||||
"supported secured operation must remain selectable before API binding: {:?}",
|
||||
secured.findings
|
||||
);
|
||||
assert!(
|
||||
ir.coverage
|
||||
.iter()
|
||||
.any(|entry| entry.location.pointer == "/security/0"
|
||||
&& entry.disposition == CoverageDisposition::Finding),
|
||||
"mixed probe has no finding coverage"
|
||||
&& entry.disposition == CoverageDisposition::Mapped),
|
||||
"mixed probe has no mapped security coverage"
|
||||
);
|
||||
probed(construct);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user