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
@@ -576,35 +576,13 @@ fn ac_2_manifest_covers_fifty_provenanced_specs_with_exact_expectations() {
|
||||
"security-scope fixture must keep both candidates explicit: {:?}",
|
||||
ir.operations.iter().map(|op| &op.key).collect::<Vec<_>>()
|
||||
);
|
||||
let requirements = ir
|
||||
.findings
|
||||
.iter()
|
||||
.filter(|finding| finding.code == "unsupported_security_requirement")
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(
|
||||
requirements.len(),
|
||||
1,
|
||||
"exactly the inherited requirement must produce a blocker: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
let requirement = &requirements[0];
|
||||
assert_eq!(
|
||||
requirement.severity,
|
||||
crank_import::rest::ImportFindingSeverity::Error,
|
||||
"security requirement must block its candidate: {:?}",
|
||||
requirement
|
||||
);
|
||||
assert_eq!(
|
||||
requirement.operation_key.as_deref(),
|
||||
Some("GET /secure"),
|
||||
"blocker must belong only to the inherited secured candidate: {:?}",
|
||||
requirement
|
||||
);
|
||||
assert_eq!(
|
||||
requirement.location.pointer, "/security/0",
|
||||
"inherited requirement must point at the document root requirement: {:?}",
|
||||
requirement
|
||||
);
|
||||
let requirements = ir.findings.iter().filter(|finding| {
|
||||
finding.code == "unsupported_security_requirements"
|
||||
}).collect::<Vec<_>>();
|
||||
assert!(requirements.is_empty(), "supported inherited basic requirement must remain selectable: {:?}", ir.findings);
|
||||
let secured_operation = ir.operations.iter().find(|operation| operation.key == "GET /secure").unwrap();
|
||||
assert!(secured_operation.security_requirements.alternatives[0].supported);
|
||||
assert_eq!(secured_operation.security_requirements.alternatives[0].source_location.as_ref().unwrap().pointer, "/security/0");
|
||||
let mut by_key = std::collections::BTreeMap::new();
|
||||
for group in &preview.groups {
|
||||
for candidate in &group.operations {
|
||||
@@ -618,18 +596,9 @@ fn ac_2_manifest_covers_fifty_provenanced_specs_with_exact_expectations() {
|
||||
"public operation with security: [] must stay actionable: {:?}",
|
||||
public.findings
|
||||
);
|
||||
assert!(
|
||||
by_key
|
||||
.get("GET /secure")
|
||||
.expect("secured candidate present")
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "unsupported_security_requirement"
|
||||
&& finding.severity
|
||||
== crank_import::rest::ImportFindingSeverity::Error),
|
||||
"inherited requirement must block the secured candidate: {:?}",
|
||||
by_key.get("GET /secure").unwrap().findings
|
||||
);
|
||||
assert!(by_key.get("GET /secure").expect("secured candidate present").findings.iter().all(|finding| {
|
||||
finding.severity != crank_import::rest::ImportFindingSeverity::Error
|
||||
}), "supported security must remain selectable before API binding: {:?}", by_key.get("GET /secure").unwrap().findings);
|
||||
assert!(
|
||||
preview
|
||||
.findings
|
||||
@@ -642,8 +611,8 @@ fn ac_2_manifest_covers_fifty_provenanced_specs_with_exact_expectations() {
|
||||
ir.coverage
|
||||
.iter()
|
||||
.any(|entry| entry.location.pointer == "/security/0"
|
||||
&& entry.disposition == CoverageDisposition::Finding),
|
||||
"inherited requirement must stay in the source ledger bound to the finding: {:?}",
|
||||
&& entry.disposition == CoverageDisposition::Mapped),
|
||||
"inherited requirement must stay mapped in the source ledger: {:?}",
|
||||
ir.coverage
|
||||
);
|
||||
let mut actual_operation_keys = preview
|
||||
|
||||
Reference in new issue
Block a user