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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,799 @@
|
||||
use crank_import::rest::{
|
||||
ImportFindingSeverity, ImportOperationCandidate, NormalizationConfig,
|
||||
NormalizedSecuritySchemeKind, SecurityParameterLocation, SecurityRequirementsSource,
|
||||
SourceDigest, normalize_verified_document, preview_from_ir, validate_normalized_ir,
|
||||
};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
fn normalize(document: &Value) -> crank_import::rest::NormalizedIr {
|
||||
let text = serde_json::to_string(document).expect("fixture serializes");
|
||||
normalize_verified_document(
|
||||
&text,
|
||||
SourceDigest::parse("b".repeat(64)).expect("digest is valid"),
|
||||
&NormalizationConfig::default(),
|
||||
)
|
||||
.expect("security fixture normalizes")
|
||||
}
|
||||
|
||||
fn candidate<'a>(
|
||||
candidates: &'a [ImportOperationCandidate],
|
||||
key: &str,
|
||||
) -> &'a ImportOperationCandidate {
|
||||
candidates
|
||||
.iter()
|
||||
.find(|candidate| candidate.key == key)
|
||||
.unwrap_or_else(|| panic!("candidate {key} missing: {candidates:?}"))
|
||||
}
|
||||
|
||||
fn candidates(ir: &crank_import::rest::NormalizedIr) -> Vec<ImportOperationCandidate> {
|
||||
preview_from_ir(ir)
|
||||
.groups
|
||||
.into_iter()
|
||||
.flat_map(|group| group.operations)
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn operation<'a>(
|
||||
ir: &'a crank_import::rest::NormalizedIr,
|
||||
path: &str,
|
||||
) -> &'a crank_import::rest::NormalizedOperation {
|
||||
ir.operations
|
||||
.iter()
|
||||
.find(|operation| operation.path == path)
|
||||
.unwrap_or_else(|| panic!("operation {path} missing: {ir:?}"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn openapi_30_and_31_project_typed_schemes_and_safe_hints() {
|
||||
for version in ["3.0.3", "3.1.0"] {
|
||||
let document = json!({
|
||||
"openapi": version,
|
||||
"info": { "title": "Security metadata", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"Bearer": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" },
|
||||
"Basic": { "type": "http", "scheme": "basic" },
|
||||
"HeaderKey": { "type": "apiKey", "in": "header", "name": "X-Api-Key" },
|
||||
"QueryKey": { "type": "apiKey", "in": "query", "name": "access_token" },
|
||||
"CookieKey": { "type": "apiKey", "in": "cookie", "name": "session" },
|
||||
"UnsafeHint": { "type": "http", "scheme": "bearer", "bearerFormat": "sk-private-value" }
|
||||
}},
|
||||
"paths": { "/private": { "get": {
|
||||
"security": [{ "Bearer": [] }],
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
assert!(matches!(ir.security_schemes["Bearer"].kind,
|
||||
NormalizedSecuritySchemeKind::Http { ref scheme, ref format_hint }
|
||||
if scheme == "bearer" && format_hint.as_deref() == Some("JWT")));
|
||||
assert!(matches!(ir.security_schemes["Basic"].kind,
|
||||
NormalizedSecuritySchemeKind::Http { ref scheme, .. } if scheme == "basic"));
|
||||
assert!(matches!(ir.security_schemes["HeaderKey"].kind,
|
||||
NormalizedSecuritySchemeKind::ApiKey { location: SecurityParameterLocation::Header, ref parameter_name, .. }
|
||||
if parameter_name == "X-Api-Key"));
|
||||
assert!(matches!(ir.security_schemes["QueryKey"].kind,
|
||||
NormalizedSecuritySchemeKind::ApiKey { location: SecurityParameterLocation::Query, ref parameter_name, .. }
|
||||
if parameter_name == "access_token"));
|
||||
assert!(matches!(ir.security_schemes["CookieKey"].kind,
|
||||
NormalizedSecuritySchemeKind::ApiKey { location: SecurityParameterLocation::Cookie, ref parameter_name, .. }
|
||||
if parameter_name == "session"));
|
||||
assert!(matches!(
|
||||
ir.security_schemes["UnsafeHint"].kind,
|
||||
NormalizedSecuritySchemeKind::Http {
|
||||
format_hint: None,
|
||||
..
|
||||
}
|
||||
));
|
||||
let requirement = &operation(&ir, "/private")
|
||||
.security_requirements
|
||||
.alternatives[0];
|
||||
assert_eq!(requirement.schemes, ["Bearer"]);
|
||||
assert!(requirement.supported);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn swagger2_projects_basic_and_api_key_header_and_query() {
|
||||
let document = json!({
|
||||
"swagger": "2.0",
|
||||
"info": { "title": "Swagger security", "version": "1" },
|
||||
"host": "security.example.test",
|
||||
"schemes": ["https"],
|
||||
"securityDefinitions": {
|
||||
"BasicAuth": { "type": "basic" },
|
||||
"HeaderKey": { "type": "apiKey", "in": "header", "name": "X-Api-Key" },
|
||||
"QueryKey": { "type": "apiKey", "in": "query", "name": "api_key" },
|
||||
"CookieKey": { "type": "apiKey", "in": "cookie", "name": "session" }
|
||||
},
|
||||
"security": [{ "BasicAuth": [] }, { "HeaderKey": [] }, { "QueryKey": [] }],
|
||||
"paths": { "/private": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
assert!(matches!(ir.security_schemes["BasicAuth"].kind,
|
||||
NormalizedSecuritySchemeKind::Http { ref scheme, .. } if scheme == "basic"));
|
||||
assert!(matches!(
|
||||
ir.security_schemes["HeaderKey"].kind,
|
||||
NormalizedSecuritySchemeKind::ApiKey {
|
||||
location: SecurityParameterLocation::Header,
|
||||
..
|
||||
}
|
||||
));
|
||||
assert!(matches!(
|
||||
ir.security_schemes["QueryKey"].kind,
|
||||
NormalizedSecuritySchemeKind::ApiKey {
|
||||
location: SecurityParameterLocation::Query,
|
||||
..
|
||||
}
|
||||
));
|
||||
assert!(matches!(
|
||||
ir.security_schemes["CookieKey"].kind,
|
||||
NormalizedSecuritySchemeKind::Unsupported { .. }
|
||||
));
|
||||
assert_eq!(
|
||||
operation(&ir, "/private")
|
||||
.security_requirements
|
||||
.alternatives
|
||||
.len(),
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn effective_requirements_inherit_override_and_allow_explicit_no_auth() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Requirements", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"Key": { "type": "apiKey", "in": "header", "name": "X-Key" },
|
||||
"Bearer": { "type": "http", "scheme": "bearer" }
|
||||
}},
|
||||
"security": [{ "Key": [] }],
|
||||
"paths": {
|
||||
"/inherited": { "get": { "responses": { "200": { "description": "ok" } } } },
|
||||
"/override": { "get": { "security": [{ "Bearer": [] }], "responses": { "200": { "description": "ok" } } } },
|
||||
"/public": { "get": { "security": [], "responses": { "200": { "description": "ok" } } } },
|
||||
"/unsecured": { "get": { "responses": { "200": { "description": "ok" } } } }
|
||||
}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let inherited = &operation(&ir, "/inherited").security_requirements;
|
||||
assert_eq!(inherited.source, SecurityRequirementsSource::Document);
|
||||
assert_eq!(inherited.alternatives[0].schemes, ["Key"]);
|
||||
let overridden = &operation(&ir, "/override").security_requirements;
|
||||
assert_eq!(overridden.source, SecurityRequirementsSource::Operation);
|
||||
assert_eq!(overridden.alternatives[0].schemes, ["Bearer"]);
|
||||
let public = &operation(&ir, "/public").security_requirements;
|
||||
assert_eq!(public.source, SecurityRequirementsSource::Operation);
|
||||
assert!(public.alternatives.is_empty());
|
||||
assert_eq!(
|
||||
operation(&ir, "/unsecured").security_requirements.source,
|
||||
SecurityRequirementsSource::Document
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn or_alternatives_are_preserved_and_unsupported_and_is_scoped() {
|
||||
let document = json!({
|
||||
"openapi": "3.1.0",
|
||||
"info": { "title": "Alternatives", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"Bearer": { "type": "http", "scheme": "bearer" },
|
||||
"One": { "type": "apiKey", "in": "header", "name": "X-One" },
|
||||
"Two": { "type": "apiKey", "in": "query", "name": "two" }
|
||||
}},
|
||||
"paths": {
|
||||
"/mixed": { "get": { "security": [
|
||||
{ "One": [], "Two": [] }, { "Bearer": [] }
|
||||
], "responses": { "200": { "description": "ok" } } } },
|
||||
"/and-only": { "get": { "security": [
|
||||
{ "One": [], "Two": [] }
|
||||
], "responses": { "200": { "description": "ok" } } } },
|
||||
"/or": { "get": { "security": [
|
||||
{ "Bearer": [] }, { "One": [] }, { "Two": [] }
|
||||
], "responses": { "200": { "description": "ok" } } } }
|
||||
}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let preview = preview_from_ir(&ir);
|
||||
let candidates = preview
|
||||
.groups
|
||||
.iter()
|
||||
.flat_map(|group| &group.operations)
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mixed = candidate(&candidates, "GET /mixed");
|
||||
assert_eq!(mixed.security_requirements.alternatives.len(), 2);
|
||||
assert!(!mixed.security_requirements.alternatives[0].supported);
|
||||
assert!(
|
||||
mixed.security_requirements.alternatives[0]
|
||||
.findings
|
||||
.contains(&"unsupported_security_and_requirement".to_owned())
|
||||
);
|
||||
assert_eq!(
|
||||
mixed.security_requirements.alternatives[0].schemes,
|
||||
["One", "Two"]
|
||||
);
|
||||
assert!(mixed.security_requirements.alternatives[1].supported);
|
||||
assert_eq!(
|
||||
mixed.security_requirements.alternatives[1].schemes,
|
||||
["Bearer"]
|
||||
);
|
||||
assert!(
|
||||
mixed
|
||||
.findings
|
||||
.iter()
|
||||
.all(|finding| finding.severity != ImportFindingSeverity::Error)
|
||||
);
|
||||
|
||||
let and_only = candidate(&candidates, "GET /and-only");
|
||||
assert!(and_only.findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
}));
|
||||
assert!(and_only.findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_and_requirement"
|
||||
&& finding.severity == ImportFindingSeverity::Warning
|
||||
&& finding.message.contains("One, Two")
|
||||
}));
|
||||
|
||||
let or = candidate(&candidates, "GET /or");
|
||||
assert_eq!(or.security_requirements.alternatives.len(), 3);
|
||||
assert!(
|
||||
or.security_requirements
|
||||
.alternatives
|
||||
.iter()
|
||||
.all(|alternative| alternative.supported)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsupported_schemes_produce_manual_configuration_findings_without_typed_credentials() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Unsupported", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"OAuth": { "type": "oauth2", "flows": { "clientCredentials": {
|
||||
"tokenUrl": "https://issuer.example/token?token=embedded",
|
||||
"scopes": { "read": "read" },
|
||||
"x-client-secret": "never-copy-this"
|
||||
}}, "x-example-token": "also-never-copy" },
|
||||
"Oidc": { "type": "openIdConnect", "openIdConnectUrl": "https://issuer.example" },
|
||||
"Mutual": { "type": "mutualTLS" },
|
||||
"Unknown": { "type": "vendorAuth", "x-api-key": "vendor-secret" }
|
||||
}},
|
||||
"paths": { "/private": { "get": {
|
||||
"security": [{ "OAuth": ["read"] }, { "Oidc": [] }, { "Mutual": [] }, { "Unknown": [] }],
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let findings = &operation(&ir, "/private").findings;
|
||||
assert!(
|
||||
findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "unsupported_security_scheme")
|
||||
);
|
||||
assert!(
|
||||
findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "unsupported_security_requirements")
|
||||
);
|
||||
assert!(
|
||||
operation(&ir, "/private")
|
||||
.security_requirements
|
||||
.alternatives
|
||||
.iter()
|
||||
.all(|alternative| !alternative.supported)
|
||||
);
|
||||
let typed = serde_json::to_string(&ir.security_schemes).unwrap();
|
||||
for secret_field in [
|
||||
"flows",
|
||||
"tokenUrl",
|
||||
"x-client-secret",
|
||||
"x-example-token",
|
||||
"x-api-key",
|
||||
] {
|
||||
assert!(
|
||||
!typed.contains(secret_field),
|
||||
"typed metadata retained {secret_field}"
|
||||
);
|
||||
}
|
||||
assert!(!typed.contains("never-copy-this"));
|
||||
assert!(!typed.contains("vendor-secret"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalized_ir_accepts_historical_v4_contract_without_security_fields() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Historical", "version": "1" },
|
||||
"paths": { "/health": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let mut ir = normalize(&document);
|
||||
ir.normalizer_version = crank_import::rest::HISTORICAL_NORMALIZER_VERSION.to_owned();
|
||||
ir.projection_version = crank_import::rest::HISTORICAL_PROJECTION_VERSION.to_owned();
|
||||
ir.security_schemes.clear();
|
||||
ir.operations[0].security_schemes.clear();
|
||||
ir.operations[0].security_requirements = Default::default();
|
||||
validate_normalized_ir(&ir).expect("historical v4 shape remains valid");
|
||||
|
||||
let serialized = serde_json::to_value(&ir).unwrap();
|
||||
let operation = &serialized["operations"][0];
|
||||
assert!(operation.get("security_requirements").is_none());
|
||||
assert!(operation.get("security_schemes").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn non_array_security_is_rejected_as_an_import_error_surface() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Malformed", "version": "1" },
|
||||
"security": "Bearer",
|
||||
"paths": { "/private": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
assert!(operation(&ir, "/private").findings.iter().any(|finding| {
|
||||
finding.code == "invalid_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
&& finding.location.pointer == "/security"
|
||||
}));
|
||||
let candidates = candidates(&ir);
|
||||
assert!(
|
||||
candidate(&candidates, "GET /private")
|
||||
.findings
|
||||
.iter()
|
||||
.any(|finding| {
|
||||
finding.code == "invalid_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_like_literals_are_redacted_from_ir_preview_and_source_snapshot() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Redaction", "version": "1" },
|
||||
"servers": [{ "url": "https://user:secret-canary@api.example.test" }],
|
||||
"paths": { "/private": { "get": {
|
||||
"parameters": [{
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"example": "Bearer header-canary"
|
||||
}, {
|
||||
"name": "X-Api-Key",
|
||||
"in": "header",
|
||||
"example": "opaque-canary-42",
|
||||
"schema": { "type": "string" }
|
||||
}, {
|
||||
"name": "X-Trace",
|
||||
"in": "header",
|
||||
"example": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjYW5hcnktNDIifQ.c2lnbmF0dXJlMTIzNDU2",
|
||||
"schema": { "type": "string" }
|
||||
}],
|
||||
"requestBody": { "content": { "application/json": { "schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"password": { "type": "string", "default": "default-canary" },
|
||||
"token": { "type": "integer", "default": 4242 },
|
||||
"passwd": { "type": "boolean", "default": true },
|
||||
"ordinaryDefault": { "type": "string", "default": "Bearer default-literal-canary" },
|
||||
"ordinary": { "type": "string", "example": "token-example-canary" }
|
||||
}
|
||||
}}}},
|
||||
"parameters": [{
|
||||
"name": "X-Api-Key", "in": "header",
|
||||
"schema": { "type": "string", "default": "opaque-header-default-canary" }
|
||||
}, {
|
||||
"name": "api_key", "in": "query",
|
||||
"schema": { "type": "string", "default": "opaque-query-default-canary" }
|
||||
}, {
|
||||
"name": "session-token", "in": "cookie",
|
||||
"schema": { "type": "string", "default": "opaque-cookie-default-canary" }
|
||||
}],
|
||||
"responses": { "200": { "description": "ok" } },
|
||||
"x-api-key": "extension-canary",
|
||||
"x-ciphertext": "opaque-ciphertext-canary",
|
||||
"x-private-key": "private-key-canary"
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let serialized_ir = serde_json::to_string(&ir).unwrap();
|
||||
let serialized_preview = serde_json::to_string(&preview_from_ir(&ir)).unwrap();
|
||||
for output in [&serialized_ir, &serialized_preview] {
|
||||
for secret in [
|
||||
"secret-canary",
|
||||
"header-canary",
|
||||
"opaque-canary-42",
|
||||
"default-canary",
|
||||
"default-literal-canary",
|
||||
"opaque-header-default-canary",
|
||||
"opaque-query-default-canary",
|
||||
"opaque-cookie-default-canary",
|
||||
"token-example-canary",
|
||||
"extension-canary",
|
||||
"opaque-ciphertext-canary",
|
||||
"private-key-canary",
|
||||
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjYW5hcnktNDIifQ.c2lnbmF0dXJlMTIzNDU2",
|
||||
"4242",
|
||||
] {
|
||||
assert!(
|
||||
!output.contains(secret),
|
||||
"output retained {secret}: {output}"
|
||||
);
|
||||
}
|
||||
}
|
||||
assert!(!serialized_ir.contains("\"default\":true"));
|
||||
assert!(serialized_ir.contains("[REDACTED]"));
|
||||
assert!(
|
||||
ir.findings
|
||||
.iter()
|
||||
.any(|finding| finding.code == "secret_like_example")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn encoded_sensitive_url_query_names_are_detected_and_sanitized() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Encoded URL credentials", "version": "1" },
|
||||
"servers": [{ "url": "https://api.example.test/?%61pi%5Fkey=encoded-query-canary®ion=west" }],
|
||||
"paths": { "/health": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err()
|
||||
);
|
||||
|
||||
let ir = normalize(&document);
|
||||
let serialized = serde_json::to_string(&ir).unwrap();
|
||||
assert!(!serialized.contains("encoded-query-canary"));
|
||||
assert!(serialized.contains("%61pi%5Fkey=[REDACTED]"));
|
||||
assert!(serialized.contains("region=west"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn declared_api_key_names_seed_parameter_and_url_redaction_context() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Declared API keys", "version": "1" },
|
||||
"servers": [{ "url": "https://api.example.test/?key=query-canary®ion=west" }],
|
||||
"components": { "securitySchemes": {
|
||||
"ClientKey": { "type": "apiKey", "in": "header", "name": "X-Client" },
|
||||
"QueryKey": { "type": "apiKey", "in": "query", "name": "key" },
|
||||
"CookieKey": { "type": "apiKey", "in": "cookie", "name": "session" }
|
||||
}},
|
||||
"paths": { "/public": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{ "name": "X-Client", "in": "header", "schema": { "type": "string", "default": "header-canary" }, "example": "header-example-canary" },
|
||||
{ "name": "session", "in": "cookie", "schema": { "type": "string", "default": "cookie-canary" } }
|
||||
],
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}
|
||||
}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err()
|
||||
);
|
||||
|
||||
let ir = normalize(&document);
|
||||
let serialized = serde_json::to_string(&ir).unwrap();
|
||||
for canary in [
|
||||
"query-canary",
|
||||
"header-canary",
|
||||
"header-example-canary",
|
||||
"cookie-canary",
|
||||
] {
|
||||
assert!(!serialized.contains(canary), "{canary} leaked into IR");
|
||||
}
|
||||
assert!(serialized.contains("key=[REDACTED]"));
|
||||
assert!(serialized.contains("region=west"));
|
||||
|
||||
let mixed_containers = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Legacy security map", "version": "1" },
|
||||
"components": { "securitySchemes": {} },
|
||||
"securityDefinitions": {
|
||||
"QueryKey": { "type": "apiKey", "in": "query", "name": "key" }
|
||||
},
|
||||
"servers": [{ "url": "https://api.example.test/?key=legacy-container-canary" }],
|
||||
"paths": { "/public": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let source = serde_json::to_string(&mixed_containers).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err()
|
||||
);
|
||||
let ir = normalize(&mixed_containers);
|
||||
let serialized = serde_json::to_string(&ir).unwrap();
|
||||
assert!(!serialized.contains("legacy-container-canary"));
|
||||
assert!(serialized.contains("key=[REDACTED]"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn credential_like_security_format_hints_are_redacted_but_jwt_is_safe() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Format hints", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"Bearer": { "type": "http", "scheme": "bearer", "bearerFormat": "sk-private-value" },
|
||||
"HeaderKey": { "type": "apiKey", "in": "header", "name": "X-Api-Key", "x-format-hint": "token-format-canary" },
|
||||
"SafeBearer": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }
|
||||
}, "headers": {
|
||||
"X-Api-Key": { "schema": { "type": "string", "default": "opaque-component-header-canary" } }
|
||||
}},
|
||||
"paths": { "/health": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err()
|
||||
);
|
||||
|
||||
let ir = normalize(&document);
|
||||
let serialized = serde_json::to_string(&ir).unwrap();
|
||||
assert!(!serialized.contains("sk-private-value"));
|
||||
assert!(!serialized.contains("token-format-canary"));
|
||||
assert!(!serialized.contains("opaque-component-header-canary"));
|
||||
assert!(serialized.contains("X-Api-Key"));
|
||||
let source_tree = serde_json::to_value(&ir.source_tree).unwrap();
|
||||
let schema = &source_tree["value"]["value"]["components"]["value"]["value"]["headers"]["value"]
|
||||
["value"]["X-Api-Key"]["value"]["value"]["schema"]["value"]["value"];
|
||||
assert_eq!(schema["type"]["value"]["value"], "string");
|
||||
assert_eq!(schema["default"]["value"]["value"], "[REDACTED]");
|
||||
assert!(matches!(
|
||||
ir.security_schemes["Bearer"].kind,
|
||||
NormalizedSecuritySchemeKind::Http {
|
||||
format_hint: None,
|
||||
..
|
||||
}
|
||||
));
|
||||
assert!(matches!(
|
||||
ir.security_schemes["HeaderKey"].kind,
|
||||
NormalizedSecuritySchemeKind::ApiKey {
|
||||
format_hint: None,
|
||||
..
|
||||
}
|
||||
));
|
||||
assert!(matches!(ir.security_schemes["SafeBearer"].kind,
|
||||
NormalizedSecuritySchemeKind::Http { ref format_hint, .. }
|
||||
if format_hint.as_deref() == Some("JWT")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unused_unsupported_openapi_definitions_get_located_manual_warning_without_blocking_public() {
|
||||
for version in ["3.0.3", "3.1.0"] {
|
||||
let document = json!({
|
||||
"openapi": version,
|
||||
"info": { "title": "Unused OAuth definition", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"OAuth": { "type": "oauth2", "flows": {} }
|
||||
}},
|
||||
"paths": { "/public": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let warning = ir
|
||||
.findings
|
||||
.iter()
|
||||
.find(|finding| finding.code == "unsupported_security_scheme_definition")
|
||||
.expect("unused unsupported definition needs a manual configuration warning");
|
||||
assert_eq!(warning.severity, ImportFindingSeverity::Warning);
|
||||
assert_eq!(
|
||||
warning.location.pointer,
|
||||
"/components/securitySchemes/OAuth"
|
||||
);
|
||||
assert!(warning.operation_key.is_none());
|
||||
assert!(
|
||||
candidate(&candidates(&ir), "GET /public")
|
||||
.findings
|
||||
.iter()
|
||||
.all(|finding| finding.severity != ImportFindingSeverity::Error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unused_unsupported_swagger_definition_gets_located_manual_warning_without_blocking_public() {
|
||||
let document = json!({
|
||||
"swagger": "2.0",
|
||||
"info": { "title": "Unused OAuth definition", "version": "1" },
|
||||
"host": "security.example.test",
|
||||
"schemes": ["https"],
|
||||
"securityDefinitions": {
|
||||
"OAuth": { "type": "oauth2", "flow": "application", "tokenUrl": "https://issuer.example/token", "scopes": {} }
|
||||
},
|
||||
"paths": { "/public": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let ir = normalize(&document);
|
||||
let warning = ir
|
||||
.findings
|
||||
.iter()
|
||||
.find(|finding| finding.code == "unsupported_security_scheme_definition")
|
||||
.expect("unused unsupported definition needs a manual configuration warning");
|
||||
assert_eq!(warning.severity, ImportFindingSeverity::Warning);
|
||||
assert_eq!(warning.location.pointer, "/securityDefinitions/OAuth");
|
||||
assert!(warning.operation_key.is_none());
|
||||
assert!(
|
||||
candidate(&candidates(&ir), "GET /public")
|
||||
.findings
|
||||
.iter()
|
||||
.all(|finding| finding.severity != ImportFindingSeverity::Error)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn url_credentials_are_redacted_without_discarding_safe_oauth_endpoints() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "URL redaction", "version": "1" },
|
||||
"components": { "securitySchemes": {
|
||||
"OAuth": { "type": "oauth2", "flows": { "clientCredentials": {
|
||||
"tokenUrl": "https://issuer.example/token",
|
||||
"authorizationUrl": "https://issuer.example/authorize?client_id=public-client"
|
||||
}} }
|
||||
}},
|
||||
"servers": [
|
||||
{ "url": "https://bare-canary@api.example.test/v1?api_key=query-canary®ion=west" },
|
||||
{ "url": "//relative-userinfo-canary@api.example.test/v1" }
|
||||
],
|
||||
"paths": { "/health": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err()
|
||||
);
|
||||
let ir = normalize(&document);
|
||||
let serialized = serde_json::to_string(&ir).unwrap();
|
||||
assert!(!serialized.contains("bare-canary"));
|
||||
assert!(!serialized.contains("relative-userinfo-canary"));
|
||||
assert!(!serialized.contains("query-canary"));
|
||||
assert!(serialized.contains("api_key=[REDACTED]"));
|
||||
assert!(serialized.contains("https://issuer.example/token"));
|
||||
assert!(serialized.contains("https://issuer.example/authorize?client_id=public-client"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sanitized_userinfo_examples_and_declared_query_urls_validate_after_redaction() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "Sanitized URL contexts",
|
||||
"version": "1",
|
||||
"description": "Docs: https://api.example.test/?key=description-query-canary"
|
||||
},
|
||||
"components": { "securitySchemes": {
|
||||
"QueryKey": { "type": "apiKey", "in": "query", "name": "key" }
|
||||
}},
|
||||
"paths": { "/health": { "get": {
|
||||
"requestBody": { "content": { "application/json": { "schema": {
|
||||
"type": "string",
|
||||
"example": "https://example-user:example-password@api.example.test/path"
|
||||
}}}},
|
||||
"responses": { "200": { "description": "ok" }
|
||||
}}}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err()
|
||||
);
|
||||
let ir = normalize(&document);
|
||||
let serialized = serde_json::to_string(&ir).unwrap();
|
||||
assert!(!serialized.contains("description-query-canary"));
|
||||
assert!(!serialized.contains("example-user"));
|
||||
assert!(!serialized.contains("example-password"));
|
||||
assert!(serialized.contains("key=[REDACTED]"));
|
||||
assert!(serialized.contains("https://api.example.test/path"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn credential_named_url_defaults_and_url_fragments_are_redacted() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Credential URLs", "version": "1" },
|
||||
"components": { "schemas": {
|
||||
"Config": { "type": "object", "properties": {
|
||||
"credentialUrl": { "type": "string", "default": "opaque-credential-url-canary" },
|
||||
"x-credential-url": "opaque-extension-url-canary",
|
||||
"callback": { "type": "string", "default": "https://issuer.example/callback#access_token=fragment-canary&state=safe" },
|
||||
"reference": { "type": "string", "default": "https://issuer.example/#/components/securitySchemes/AccessToken" }
|
||||
}}
|
||||
}},
|
||||
"paths": { "/health": { "get": {
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
assert!(
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.is_err(),
|
||||
"credentialUrl and URL fragment credentials must fail source preflight"
|
||||
);
|
||||
let serialized = serde_json::to_string(&normalize(&document)).unwrap();
|
||||
assert!(!serialized.contains("opaque-credential-url-canary"));
|
||||
assert!(!serialized.contains("opaque-extension-url-canary"));
|
||||
assert!(!serialized.contains("fragment-canary"));
|
||||
assert!(serialized.contains("[REDACTED]"));
|
||||
assert!(serialized.contains("#access_token=[REDACTED]&state=safe"));
|
||||
let safe_pointer = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "JSON pointer", "version": "1" },
|
||||
"paths": { "/health": { "get": {
|
||||
"description": "#/components/securitySchemes/AccessToken",
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
crank_import::rest::validate_document_source_safe(
|
||||
&serde_json::to_string(&safe_pointer).unwrap(),
|
||||
&NormalizationConfig::default(),
|
||||
)
|
||||
.expect("JSON-pointer fragments are references, not credential parameters");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sensitive_identifiers_preserve_schemes_requirements_and_schema_metadata() {
|
||||
let document = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Safe identifiers", "version": "1" },
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"AccessToken": { "type": "http", "scheme": "bearer" }
|
||||
},
|
||||
"schemas": { "Password": { "type": "string" } }
|
||||
},
|
||||
"security": [{ "AccessToken": [] }],
|
||||
"paths": { "/login": { "post": {
|
||||
"requestBody": { "content": { "application/json": { "schema": {
|
||||
"type": "object", "properties": {
|
||||
"password": { "type": "string", "description": "Password input" }
|
||||
}
|
||||
}}}},
|
||||
"responses": { "200": { "description": "ok" } }
|
||||
}}}
|
||||
});
|
||||
let source = serde_json::to_string(&document).unwrap();
|
||||
crank_import::rest::validate_document_source_safe(&source, &NormalizationConfig::default())
|
||||
.expect("names and schema declarations contain no literal credentials");
|
||||
let ir = normalize(&document);
|
||||
assert!(ir.security_schemes.contains_key("AccessToken"));
|
||||
assert!(operation(&ir, "/login").security_requirements.alternatives[0].supported);
|
||||
let schema = operation(&ir, "/login")
|
||||
.request_body_schema
|
||||
.as_ref()
|
||||
.unwrap();
|
||||
let crank_import::rest::NormalizedSchemaKind::Object { properties, .. } = &schema.kind else {
|
||||
panic!("request object schema must survive redaction");
|
||||
};
|
||||
assert_eq!(
|
||||
properties["password"].description.as_deref(),
|
||||
Some("Password input")
|
||||
);
|
||||
assert!(matches!(
|
||||
properties["password"].kind,
|
||||
crank_import::rest::NormalizedSchemaKind::Scalar { .. }
|
||||
));
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
//! - an OR array with an empty requirement object `{}` exposes the public
|
||||
//! alternative and must keep the affected operation actionable, without
|
||||
//! touching other operations;
|
||||
//! - a single non-empty requirement must remain a blocker (regression anchor);
|
||||
//! - supported non-empty requirements remain resolvable for profile binding;
|
||||
//! - malformed security shapes (non-array value, non-object array item) must
|
||||
//! produce a source-located operation blocker instead of silently
|
||||
//! disappearing.
|
||||
@@ -50,19 +50,30 @@ fn candidate<'a>(
|
||||
}
|
||||
|
||||
fn security_findings<'a>(
|
||||
findings: &'a [NormalizedFinding],
|
||||
ir: &'a crank_import::rest::NormalizedIr,
|
||||
key: &str,
|
||||
) -> Vec<&'a NormalizedFinding> {
|
||||
findings
|
||||
.iter()
|
||||
all_findings(ir)
|
||||
.into_iter()
|
||||
.filter(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
finding.code == "invalid_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
&& finding.operation_key.as_deref() == Some(key)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn all_findings(ir: &crank_import::rest::NormalizedIr) -> Vec<&NormalizedFinding> {
|
||||
ir.findings
|
||||
.iter()
|
||||
.chain(
|
||||
ir.operations
|
||||
.iter()
|
||||
.flat_map(|operation| &operation.findings),
|
||||
)
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_or_alternative_makes_the_operation_public() {
|
||||
// Document-level OR array: [{"probe": []}, {}] offers an explicit public
|
||||
@@ -91,7 +102,7 @@ fn empty_or_alternative_makes_the_operation_public() {
|
||||
public.findings
|
||||
);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /public").is_empty(),
|
||||
security_findings(&ir, "GET /public").is_empty(),
|
||||
"no security blocker may belong to the public operation: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
@@ -129,33 +140,28 @@ fn or_alternative_keeps_only_that_operation_public() {
|
||||
);
|
||||
let closed = candidate(&preview, "GET /closed");
|
||||
assert!(
|
||||
closed.findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
}),
|
||||
"non-empty requirement must still block the candidate: {:?}",
|
||||
closed
|
||||
.findings
|
||||
.iter()
|
||||
.all(|finding| finding.severity != ImportFindingSeverity::Error),
|
||||
"well-formed supported requirement must remain resolvable: {:?}",
|
||||
closed.findings
|
||||
);
|
||||
let ir_blocker = security_findings(&ir.findings, "GET /closed")[0];
|
||||
assert!(security_findings(&ir, "GET /closed").is_empty());
|
||||
assert!(closed.security_requirements.alternatives[0].supported);
|
||||
assert_eq!(
|
||||
ir_blocker.location.pointer, "/paths/~1closed/get/security/0",
|
||||
"blocker must point at the local requirement: {:?}",
|
||||
ir_blocker
|
||||
closed.security_requirements.alternatives[0].schemes,
|
||||
["probe"]
|
||||
);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /closed").len() == 1,
|
||||
"exactly one blocker for the closed operation: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /open").is_empty(),
|
||||
security_findings(&ir, "GET /open").is_empty(),
|
||||
"the public alternative must not leak into the open operation: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nonempty_requirement_still_blocks_with_auth_profile_contract() {
|
||||
fn well_formed_requirement_stays_resolvable_for_auth_profile_binding() {
|
||||
let source = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Security scope regression", "version": "1" },
|
||||
@@ -170,25 +176,18 @@ fn nonempty_requirement_still_blocks_with_auth_profile_contract() {
|
||||
}
|
||||
});
|
||||
let (ir, preview) = run(&source);
|
||||
let blocker = security_findings(&ir.findings, "GET /secured")
|
||||
.into_iter()
|
||||
.next()
|
||||
.cloned()
|
||||
.unwrap_or_else(|| panic!("non-empty requirement must block: {:?}", ir.findings));
|
||||
assert_eq!(blocker.location.pointer, "/security/0");
|
||||
assert_eq!(
|
||||
blocker.message,
|
||||
"Требование безопасности должно быть привязано к настроенному Auth Profile перед публикацией этой операции; остальные операции не блокируются.",
|
||||
"Auth Profile contract message must be stable"
|
||||
);
|
||||
assert!(security_findings(&ir, "GET /secured").is_empty());
|
||||
let secured = candidate(&preview, "GET /secured");
|
||||
assert!(
|
||||
secured.findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
}),
|
||||
"blocked candidate must expose the blocker: {:?}",
|
||||
secured.findings
|
||||
secured
|
||||
.findings
|
||||
.iter()
|
||||
.all(|finding| finding.severity != ImportFindingSeverity::Error)
|
||||
);
|
||||
assert!(secured.security_requirements.alternatives[0].supported);
|
||||
assert_eq!(
|
||||
secured.security_requirements.source,
|
||||
crank_import::rest::SecurityRequirementsSource::Document
|
||||
);
|
||||
}
|
||||
|
||||
@@ -209,7 +208,7 @@ fn malformed_security_shapes_block_the_affected_operation() {
|
||||
});
|
||||
let (ir, preview) = run(&source);
|
||||
for key in ["GET /one", "GET /two"] {
|
||||
let blocker = security_findings(&ir.findings, key)
|
||||
let blocker = security_findings(&ir, key)
|
||||
.into_iter()
|
||||
.next()
|
||||
.cloned()
|
||||
@@ -221,14 +220,15 @@ fn malformed_security_shapes_block_the_affected_operation() {
|
||||
);
|
||||
assert!(
|
||||
candidate(&preview, key).findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
finding.code == "invalid_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
}),
|
||||
"{key} candidate must be blocked"
|
||||
);
|
||||
}
|
||||
|
||||
// Non-object array item: the item pointer must be preserved.
|
||||
// Non-object array item: the array is fail-closed and the item has a
|
||||
// source-located warning.
|
||||
let source = json!({
|
||||
"openapi": "3.0.3",
|
||||
"info": { "title": "Security scope regression", "version": "1" },
|
||||
@@ -240,16 +240,21 @@ fn malformed_security_shapes_block_the_affected_operation() {
|
||||
}
|
||||
});
|
||||
let (ir, _) = run(&source);
|
||||
let blocker = security_findings(&ir.findings, "GET /one")
|
||||
let blocker = security_findings(&ir, "GET /one")
|
||||
.into_iter()
|
||||
.next()
|
||||
.cloned()
|
||||
.unwrap_or_else(|| panic!("non-object security item must block: {:?}", ir.findings));
|
||||
assert_eq!(
|
||||
blocker.location.pointer, "/security/0",
|
||||
"blocker must point at the malformed item: {:?}",
|
||||
blocker.location.pointer, "/security",
|
||||
"blocker must point at the malformed array: {:?}",
|
||||
blocker
|
||||
);
|
||||
assert!(all_findings(&ir).iter().any(|finding| {
|
||||
finding.code == "invalid_security_requirement"
|
||||
&& finding.severity == ImportFindingSeverity::Warning
|
||||
&& finding.location.pointer == "/security/0"
|
||||
}));
|
||||
|
||||
// Malformed operation-level security must not affect the neighbour.
|
||||
let source = json!({
|
||||
@@ -264,7 +269,7 @@ fn malformed_security_shapes_block_the_affected_operation() {
|
||||
}
|
||||
});
|
||||
let (ir, preview) = run(&source);
|
||||
let blocker = security_findings(&ir.findings, "GET /bad")
|
||||
let blocker = security_findings(&ir, "GET /bad")
|
||||
.into_iter()
|
||||
.next()
|
||||
.cloned()
|
||||
@@ -275,7 +280,7 @@ fn malformed_security_shapes_block_the_affected_operation() {
|
||||
blocker
|
||||
);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /fine").is_empty(),
|
||||
security_findings(&ir, "GET /fine").is_empty(),
|
||||
"the neighbour operation must not inherit a local defect: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
@@ -307,25 +312,29 @@ fn empty_alternative_needs_a_well_formed_array() {
|
||||
}
|
||||
});
|
||||
let (ir, preview) = run(&source);
|
||||
let at_item = |pointer: &str| {
|
||||
ir.findings
|
||||
.iter()
|
||||
let at_pointer = |pointer: &str, code: &str| {
|
||||
all_findings(&ir)
|
||||
.into_iter()
|
||||
.find(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
finding.code == code
|
||||
&& finding.operation_key.as_deref() == Some("GET /mixed")
|
||||
&& finding.location.pointer == pointer
|
||||
})
|
||||
.unwrap_or_else(|| panic!("blocker at {pointer} missing: {:?}", ir.findings))
|
||||
.unwrap_or_else(|| panic!("{code} finding at {pointer} missing: {:?}", ir.findings))
|
||||
};
|
||||
let secured = at_item("/security/0");
|
||||
assert_eq!(
|
||||
secured.message,
|
||||
"Требование безопасности должно быть привязано к настроенному Auth Profile перед публикацией этой операции; остальные операции не блокируются."
|
||||
at_pointer("/security", "invalid_security_requirements").severity,
|
||||
ImportFindingSeverity::Error
|
||||
);
|
||||
let malformed = at_item("/security/2");
|
||||
assert_eq!(
|
||||
malformed.message,
|
||||
"security содержит альтернативу без объекта требований: формат не поддерживается, операция не публикуется."
|
||||
at_pointer("/security/2", "invalid_security_requirement").severity,
|
||||
ImportFindingSeverity::Warning
|
||||
);
|
||||
assert!(
|
||||
candidate(&preview, "GET /mixed")
|
||||
.security_requirements
|
||||
.alternatives[0]
|
||||
.supported
|
||||
);
|
||||
assert!(
|
||||
candidate(&preview, "GET /mixed")
|
||||
@@ -365,10 +374,10 @@ fn object_instead_of_security_array_has_scoped_coverage() {
|
||||
} else {
|
||||
"/security"
|
||||
};
|
||||
let blocker = security_findings(&ir.findings, "GET /bad");
|
||||
let blocker = security_findings(&ir, "GET /bad");
|
||||
assert_eq!(blocker.len(), 1, "{version} {local}: {:?}", ir.findings);
|
||||
assert_eq!(blocker[0].location.pointer, expected);
|
||||
assert!(security_findings(&ir.findings, "GET /public").is_empty());
|
||||
assert!(security_findings(&ir, "GET /public").is_empty());
|
||||
assert!(
|
||||
candidate(&preview, "GET /public")
|
||||
.findings
|
||||
@@ -435,7 +444,7 @@ fn openapi_31_non_array_root_security_blocks_inherited_operations() {
|
||||
);
|
||||
let (ir, preview) = run(&Value::Object(fixture));
|
||||
for key in ["GET /one", "GET /two"] {
|
||||
let blockers = security_findings(&ir.findings, key);
|
||||
let blockers = security_findings(&ir, key);
|
||||
assert_eq!(
|
||||
blockers.len(),
|
||||
1,
|
||||
@@ -444,7 +453,7 @@ fn openapi_31_non_array_root_security_blocks_inherited_operations() {
|
||||
);
|
||||
let blocker = &blockers[0];
|
||||
assert_eq!(
|
||||
blocker.code, "unsupported_security_requirement",
|
||||
blocker.code, "invalid_security_requirements",
|
||||
"stable finding code: {blocker:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -458,7 +467,7 @@ fn openapi_31_non_array_root_security_blocks_inherited_operations() {
|
||||
);
|
||||
assert!(
|
||||
candidate(&preview, key).findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
finding.code == "invalid_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
}),
|
||||
"{key} candidate must be blocked"
|
||||
@@ -481,10 +490,10 @@ fn openapi_31_malformed_local_security_affects_only_that_operation() {
|
||||
}),
|
||||
);
|
||||
let (ir, preview) = run(&Value::Object(fixture));
|
||||
let blockers = security_findings(&ir.findings, "GET /bad");
|
||||
let blockers = security_findings(&ir, "GET /bad");
|
||||
assert_eq!(blockers.len(), 1, "exactly one blocker: {:?}", ir.findings);
|
||||
assert_eq!(
|
||||
blockers[0].code, "unsupported_security_requirement",
|
||||
blockers[0].code, "invalid_security_requirements",
|
||||
"stable finding code"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -498,7 +507,7 @@ fn openapi_31_malformed_local_security_affects_only_that_operation() {
|
||||
blockers[0]
|
||||
);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /public").is_empty(),
|
||||
security_findings(&ir, "GET /public").is_empty(),
|
||||
"the public neighbour must not inherit a local defect: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
@@ -520,7 +529,7 @@ fn openapi_31_public_alternative_with_malformed_sibling_does_not_go_public() {
|
||||
json!({ "/mixed": get200("mixedOp31", None) }),
|
||||
);
|
||||
let (ir, preview) = run(&Value::Object(fixture));
|
||||
let blockers = security_findings(&ir.findings, "GET /mixed");
|
||||
let blockers = security_findings(&ir, "GET /mixed");
|
||||
assert_eq!(
|
||||
blockers.len(),
|
||||
1,
|
||||
@@ -528,14 +537,15 @@ fn openapi_31_public_alternative_with_malformed_sibling_does_not_go_public() {
|
||||
ir.findings
|
||||
);
|
||||
assert_eq!(
|
||||
blockers[0].location.pointer, "/security/1",
|
||||
"blocker must point at the non-object item: {:?}",
|
||||
blockers[0].location.pointer, "/security",
|
||||
"fail-closed blocker must point at the malformed array: {:?}",
|
||||
blockers[0]
|
||||
);
|
||||
assert_eq!(
|
||||
blockers[0].message,
|
||||
"security содержит альтернативу без объекта требований: формат не поддерживается, операция не публикуется."
|
||||
);
|
||||
assert!(all_findings(&ir).iter().any(|finding| {
|
||||
finding.code == "invalid_security_requirement"
|
||||
&& finding.severity == ImportFindingSeverity::Warning
|
||||
&& finding.location.pointer == "/security/1"
|
||||
}));
|
||||
assert!(
|
||||
candidate(&preview, "GET /mixed")
|
||||
.findings
|
||||
@@ -558,7 +568,7 @@ fn swagger2_non_array_root_security_blocks_inherited_operations() {
|
||||
);
|
||||
let (ir, preview) = run(&Value::Object(fixture));
|
||||
for key in ["GET /one", "GET /two"] {
|
||||
let blockers = security_findings(&ir.findings, key);
|
||||
let blockers = security_findings(&ir, key);
|
||||
assert_eq!(
|
||||
blockers.len(),
|
||||
1,
|
||||
@@ -567,7 +577,7 @@ fn swagger2_non_array_root_security_blocks_inherited_operations() {
|
||||
);
|
||||
let blocker = &blockers[0];
|
||||
assert_eq!(
|
||||
blocker.code, "unsupported_security_requirement",
|
||||
blocker.code, "invalid_security_requirements",
|
||||
"stable finding code: {blocker:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -581,7 +591,7 @@ fn swagger2_non_array_root_security_blocks_inherited_operations() {
|
||||
);
|
||||
assert!(
|
||||
candidate(&preview, key).findings.iter().any(|finding| {
|
||||
finding.code == "unsupported_security_requirement"
|
||||
finding.code == "invalid_security_requirements"
|
||||
&& finding.severity == ImportFindingSeverity::Error
|
||||
}),
|
||||
"{key} candidate must be blocked"
|
||||
@@ -604,9 +614,9 @@ fn swagger2_malformed_local_security_affects_only_that_operation() {
|
||||
}),
|
||||
);
|
||||
let (ir, preview) = run(&Value::Object(fixture));
|
||||
let blockers = security_findings(&ir.findings, "GET /bad");
|
||||
let blockers = security_findings(&ir, "GET /bad");
|
||||
assert_eq!(blockers.len(), 1, "exactly one blocker: {:?}", ir.findings);
|
||||
assert_eq!(blockers[0].code, "unsupported_security_requirement");
|
||||
assert_eq!(blockers[0].code, "invalid_security_requirements");
|
||||
assert_eq!(blockers[0].severity, ImportFindingSeverity::Error);
|
||||
assert_eq!(
|
||||
blockers[0].location.pointer, "/paths/~1bad/get/security",
|
||||
@@ -614,7 +624,7 @@ fn swagger2_malformed_local_security_affects_only_that_operation() {
|
||||
blockers[0]
|
||||
);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /public").is_empty(),
|
||||
security_findings(&ir, "GET /public").is_empty(),
|
||||
"the public neighbour must not inherit a local defect: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
@@ -636,7 +646,7 @@ fn swagger2_public_alternative_with_malformed_sibling_does_not_go_public() {
|
||||
json!({ "/mixed": get200("mixedOpS2", None) }),
|
||||
);
|
||||
let (ir, preview) = run(&Value::Object(fixture));
|
||||
let blockers = security_findings(&ir.findings, "GET /mixed");
|
||||
let blockers = security_findings(&ir, "GET /mixed");
|
||||
assert_eq!(
|
||||
blockers.len(),
|
||||
1,
|
||||
@@ -644,14 +654,15 @@ fn swagger2_public_alternative_with_malformed_sibling_does_not_go_public() {
|
||||
ir.findings
|
||||
);
|
||||
assert_eq!(
|
||||
blockers[0].location.pointer, "/security/1",
|
||||
"blocker must point at the non-object item: {:?}",
|
||||
blockers[0].location.pointer, "/security",
|
||||
"fail-closed blocker must point at the malformed array: {:?}",
|
||||
blockers[0]
|
||||
);
|
||||
assert_eq!(
|
||||
blockers[0].message,
|
||||
"security содержит альтернативу без объекта требований: формат не поддерживается, операция не публикуется."
|
||||
);
|
||||
assert!(all_findings(&ir).iter().any(|finding| {
|
||||
finding.code == "invalid_security_requirement"
|
||||
&& finding.severity == ImportFindingSeverity::Warning
|
||||
&& finding.location.pointer == "/security/1"
|
||||
}));
|
||||
assert!(
|
||||
candidate(&preview, "GET /mixed")
|
||||
.findings
|
||||
@@ -675,7 +686,7 @@ fn empty_security_array_stays_public() {
|
||||
});
|
||||
let (ir, preview) = run(&source);
|
||||
assert!(
|
||||
security_findings(&ir.findings, "GET /public").is_empty(),
|
||||
security_findings(&ir, "GET /public").is_empty(),
|
||||
"explicit empty override must stay public: {:?}",
|
||||
ir.findings
|
||||
);
|
||||
|
||||
@@ -598,19 +598,19 @@ constructs:
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.0"
|
||||
construct_id: "security.bearer"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Bearer scheme metadata and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.0"
|
||||
construct_id: "security.basic"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Basic scheme metadata and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.0"
|
||||
construct_id: "security.api_key"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "API key location/name and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.0"
|
||||
construct_id: "security.override_empty"
|
||||
status: supported
|
||||
@@ -618,9 +618,9 @@ constructs:
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.0"
|
||||
construct_id: "security.mixed_operations"
|
||||
status: unsupported
|
||||
preserved_semantics: "Only the operation carrying an effective security requirement receives the source-located blocker; operations overriding it with an empty security array remain actionable."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Effective security metadata is retained on the inherited operation; explicit empty overrides remain public and actionable."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.0"
|
||||
construct_id: "media_type.application_xml.request"
|
||||
status: unsupported
|
||||
@@ -1238,19 +1238,19 @@ constructs:
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.1"
|
||||
construct_id: "security.bearer"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Bearer scheme metadata and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.1"
|
||||
construct_id: "security.basic"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Basic scheme metadata and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.1"
|
||||
construct_id: "security.api_key"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "API key location/name and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.1"
|
||||
construct_id: "security.override_empty"
|
||||
status: supported
|
||||
@@ -1258,9 +1258,9 @@ constructs:
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.1"
|
||||
construct_id: "security.mixed_operations"
|
||||
status: unsupported
|
||||
preserved_semantics: "Only the operation carrying an effective security requirement receives the source-located blocker; operations overriding it with an empty security array remain actionable."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Effective security metadata is retained on the inherited operation; explicit empty overrides remain public and actionable."
|
||||
expected_finding: "none"
|
||||
- specification_version: "OpenAPI 3.1"
|
||||
construct_id: "media_type.application_xml.request"
|
||||
status: unsupported
|
||||
@@ -1879,18 +1879,18 @@ constructs:
|
||||
- specification_version: "Swagger 2.0"
|
||||
construct_id: "security.bearer"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
preserved_semantics: "Swagger OAuth2 semantics require manual setup; OAuth credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirements"
|
||||
- specification_version: "Swagger 2.0"
|
||||
construct_id: "security.basic"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Basic scheme metadata and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "Swagger 2.0"
|
||||
construct_id: "security.api_key"
|
||||
status: unsupported
|
||||
preserved_semantics: "The source security requirement is retained as a blocker until an administrator selects a compatible Auth Profile; credentials are never copied into the import preview."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "API key location/name and OR alternatives are retained without credentials; the import API resolves an Auth Profile binding."
|
||||
expected_finding: "none"
|
||||
- specification_version: "Swagger 2.0"
|
||||
construct_id: "security.override_empty"
|
||||
status: supported
|
||||
@@ -1898,9 +1898,9 @@ constructs:
|
||||
expected_finding: "none"
|
||||
- specification_version: "Swagger 2.0"
|
||||
construct_id: "security.mixed_operations"
|
||||
status: unsupported
|
||||
preserved_semantics: "Only the operation carrying an effective security requirement receives the source-located blocker; operations overriding it with an empty security array remain actionable."
|
||||
expected_finding: "unsupported_security_requirement"
|
||||
status: supported
|
||||
preserved_semantics: "Effective basic security metadata is retained on the inherited operation; explicit empty overrides remain public and actionable."
|
||||
expected_finding: "none"
|
||||
- specification_version: "Swagger 2.0"
|
||||
construct_id: "media_type.application_xml.request"
|
||||
status: unsupported
|
||||
|
||||
Reference in new issue
Block a user