mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 15:49:33 -05:00
fix(cloudformation): drop undeclared OpenAPI authorizer schemes (#6632)
This commit is contained in:
1 parent
7453011c43
commit
f32db4fe49
4 files changed
+103
-11
No files matched your search
@@ -107,6 +107,22 @@ final class SamRestApiAuth {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!swagger) {
|
||||
removeUndeclaredCustomSchemes(document, definitions);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUndeclaredCustomSchemes(ObjectNode document, ObjectNode definitions) {
|
||||
// SAM builds securityDefinitions first, then replaces OpenAPI securitySchemes with it.
|
||||
// Inline OpenAPI authorizers absent from that generated map do not reach the importer.
|
||||
Iterator<Map.Entry<String, JsonNode>> schemes = definitions.fields();
|
||||
while (schemes.hasNext()) {
|
||||
Map.Entry<String, JsonNode> scheme = schemes.next();
|
||||
if (scheme.getValue().has("x-amazon-apigateway-authorizer")
|
||||
&& !document.path("securityDefinitions").has(scheme.getKey())) {
|
||||
schemes.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyDefaults(ObjectNode operation, ObjectNode definitions, boolean iam, boolean keyRequired) {
|
||||
|
||||
Reference in new issue
Block a user