cdk-factory 0.7.27__tar.gz → 0.7.28__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/PKG-INFO +1 -1
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/pyproject.toml +1 -1
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/api_gateway/api_gateway_stack.py +47 -108
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/api_gateway_integration_utility.py +10 -6
- cdk_factory-0.7.28/src/cdk_factory/version.py +1 -0
- cdk_factory-0.7.27/src/cdk_factory/version.py +0 -1
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/.gitignore +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/LICENSE +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/README.md +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/archive/README.md +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/archive/migrate_to_enhanced_ssm.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/mypy.ini +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/publish_to_pypi.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/publish_to_pypi.sh +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/pysetup.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/pysetup.sh +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/requirements.dev.txt +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/requirements.tests.txt +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/requirements.txt +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/run-checks.sh +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/run-tests.sh +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/app.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/builds/README.md +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/cdk.json +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/commands/command_loader.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/base_config.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/cdk_config.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/deployment.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/deployment_wave.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/devops.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/enhanced_base_config.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/enhanced_ssm_config.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/management.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/pipeline.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/pipeline_stage.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/_resources.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/api_gateway.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/apigateway_route_config.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/auto_scaling.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/cloudfront.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/cloudwatch_widget.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/code_artifact.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/code_artifact_login.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/code_repository.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/cognito.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/docker.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/dynamodb.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/ecr.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/exisiting.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/lambda_function.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/lambda_layers.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/lambda_triggers.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/load_balancer.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/rds.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/resource_mapping.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/resource_naming.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/resource_types.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/route53.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/route53_hosted_zone.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/s3.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/security_group.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/security_group_full_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/sqs.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/vpc.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/workload.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/cloudfront/cloudfront_distribution_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/ecr/ecr_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/lambdas/lambda_function_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/lambdas/lambda_function_docker_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/lambdas/lambda_function_role_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/lambdas/policies/policy_statements.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/s3_buckets/s3_bucket_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_destination_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/s3_buckets/s3_bucket_replication_source_construct.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/interfaces/enhanced_ssm_parameter_mixin.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/interfaces/istack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/interfaces/live_ssm_resolver.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/interfaces/ssm_parameter_mixin.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/lambdas/health_handler.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/pipeline/pipeline_factory.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/pipeline/security/policies.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/pipeline/security/roles.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/pipeline/stage.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack/istack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack/stack_factory.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack/stack_module_loader.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack/stack_module_registry.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack/stack_modules.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/auto_scaling/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/auto_scaling/auto_scaling_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/aws_lambdas/lambda_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/buckets/README.md +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/buckets/bucket_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/code_artifact/code_artifact_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/cognito/cognito_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/ecr/README.md +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/ecr/ecr_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/load_balancer/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/load_balancer/load_balancer_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/rds/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/rds/rds_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/route53/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/route53/route53_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/security_group/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/security_group/security_group_full_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/security_group/security_group_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/simple_queue_service/sqs_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/stack_base.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/vpc/__init__.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/vpc/vpc_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/websites/static_website_stack.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stages/websites/static_website_stage.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/commandline_args.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/configuration_loader.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/docker_utilities.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/environment_services.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/file_operations.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/git_utilities.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/json_loading_utility.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/lambda_function_utilities.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/os_execute.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utils/api_gateway_utilities.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/workload/workload_factory.py +0 -0
- {cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/handlers/test/handler.py +0 -0
|
@@ -349,113 +349,36 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
|
|
|
349
349
|
|
|
350
350
|
def _validate_authorization_configuration(self, route, has_cognito_authorizer):
|
|
351
351
|
"""
|
|
352
|
-
Validate authorization configuration
|
|
353
|
-
|
|
354
|
-
This
|
|
355
|
-
|
|
356
|
-
- If Cognito is not available and route wants COGNITO auth, raises error
|
|
357
|
-
- Provides verbose warnings for monitoring and security awareness
|
|
358
|
-
|
|
359
|
-
Args:
|
|
360
|
-
route (dict): Route configuration
|
|
361
|
-
has_cognito_authorizer (bool): Whether a Cognito authorizer is configured
|
|
362
|
-
|
|
363
|
-
Raises:
|
|
364
|
-
ValueError: When there are security conflicts without explicit overrides
|
|
352
|
+
Validate authorization configuration using the shared utility method.
|
|
353
|
+
|
|
354
|
+
This delegates to the ApiGatewayIntegrationUtility for consistent validation
|
|
355
|
+
across both API Gateway stack and Lambda stack patterns.
|
|
365
356
|
"""
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
357
|
+
# Convert route dict to ApiGatewayConfigRouteConfig for utility validation
|
|
358
|
+
# Map "path" to "route" for compatibility with the config object
|
|
359
|
+
route_config_dict = dict(route) # Create a copy
|
|
360
|
+
if "path" in route_config_dict:
|
|
361
|
+
route_config_dict["route"] = route_config_dict["path"]
|
|
362
|
+
|
|
363
|
+
api_route_config = ApiGatewayConfigRouteConfig(route_config_dict)
|
|
364
|
+
|
|
365
|
+
# Use the utility's enhanced validation method
|
|
366
|
+
validated_config = self.integration_utility._validate_and_adjust_authorization_configuration(
|
|
367
|
+
api_route_config, has_cognito_authorizer
|
|
371
368
|
)
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
logger = logging.getLogger(__name__)
|
|
376
|
-
|
|
377
|
-
# Case 1: Cognito available + NONE requested + No explicit override = ERROR
|
|
378
|
-
if has_cognito_authorizer and auth_type == "NONE" and not explicit_override:
|
|
379
|
-
error_msg = (
|
|
380
|
-
f"🚨 SECURITY CONFLICT DETECTED for route {route_path} ({method}):\n"
|
|
381
|
-
f" ❌ Cognito authorizer is configured (manual or auto-import)\n"
|
|
382
|
-
f" ❌ authorization_type is set to 'NONE' (public access)\n"
|
|
383
|
-
f" ❌ This creates a security risk - public endpoint with auth available\n\n"
|
|
384
|
-
f"💡 SOLUTIONS:\n"
|
|
385
|
-
f" 1. Remove Cognito configuration if you want public access\n"
|
|
386
|
-
f" 2. Add 'allow_public_override': true to explicitly allow public access\n"
|
|
387
|
-
f" 3. Remove 'authorization_type': 'NONE' to use secure Cognito auth\n\n"
|
|
388
|
-
f"🔒 This prevents accidental public endpoints when authentication is available.\n\n"
|
|
389
|
-
f"👉 ApiGatewayStack documentation for more details: https://github.com/your-repo/api-gateway-stack"
|
|
390
|
-
)
|
|
391
|
-
raise ValueError(error_msg)
|
|
392
|
-
|
|
393
|
-
# Case 2: No Cognito + COGNITO explicitly requested = ERROR
|
|
394
|
-
# Only error if COGNITO was explicitly requested, not if it's the default
|
|
395
|
-
if not has_cognito_authorizer and route.get("authorization_type") == "COGNITO":
|
|
396
|
-
error_msg = (
|
|
397
|
-
f"🚨 CONFIGURATION ERROR for route {route_path} ({method}):\n"
|
|
398
|
-
f" ❌ authorization_type is explicitly set to 'COGNITO' but no Cognito authorizer configured\n"
|
|
399
|
-
f" ❌ Cannot secure endpoint without authentication provider\n\n"
|
|
400
|
-
f"💡 SOLUTIONS:\n"
|
|
401
|
-
f" 1. Add Cognito configuration to enable authentication\n"
|
|
402
|
-
f" 2. Set authorization_type to 'NONE' for public access\n"
|
|
403
|
-
f" 3. Configure SSM auto-import for user_pool_arn\n"
|
|
404
|
-
f" 4. Remove explicit authorization_type to use default behavior"
|
|
405
|
-
)
|
|
406
|
-
raise ValueError(error_msg)
|
|
407
|
-
|
|
408
|
-
# Case 3: Cognito available + NONE requested + Explicit override = WARN
|
|
409
|
-
if has_cognito_authorizer and auth_type == "NONE" and explicit_override:
|
|
410
|
-
warning_msg = (
|
|
411
|
-
f"⚠️ PUBLIC ENDPOINT CONFIGURED: {route_path} ({method})\n"
|
|
412
|
-
f" 🔓 This endpoint is intentionally public (allow_public_override: true)\n"
|
|
413
|
-
f" 🔐 Cognito authentication is available but overridden\n"
|
|
414
|
-
f" 📊 Consider monitoring this endpoint for unexpected usage patterns\n"
|
|
415
|
-
f" 🔍 Review periodically: Should this endpoint be secured?"
|
|
416
|
-
)
|
|
417
|
-
|
|
418
|
-
# Print to console during deployment for visibility
|
|
419
|
-
print(warning_msg)
|
|
420
|
-
|
|
421
|
-
# Structured logging for monitoring and metrics
|
|
422
|
-
logger.warning(
|
|
423
|
-
"Public endpoint configured with Cognito available",
|
|
424
|
-
extra={
|
|
425
|
-
"route": route_path,
|
|
426
|
-
"method": method,
|
|
427
|
-
"security_override": True,
|
|
428
|
-
"cognito_available": True,
|
|
429
|
-
"authorization_type": "NONE",
|
|
430
|
-
"metric_name": "public_endpoint_with_cognito",
|
|
431
|
-
"security_decision": "intentional_public",
|
|
432
|
-
"recommendation": "review_periodically",
|
|
433
|
-
},
|
|
434
|
-
)
|
|
435
|
-
|
|
436
|
-
# Case 4: No Cognito + NONE = INFO (expected for public-only APIs)
|
|
437
|
-
if not has_cognito_authorizer and auth_type == "NONE":
|
|
438
|
-
logger.info(
|
|
439
|
-
f"Public endpoint configured (no Cognito available): {route_path} ({method})",
|
|
440
|
-
extra={
|
|
441
|
-
"route": route_path,
|
|
442
|
-
"method": method,
|
|
443
|
-
"authorization_type": "NONE",
|
|
444
|
-
"cognito_available": False,
|
|
445
|
-
"security_decision": "public_only_api",
|
|
446
|
-
},
|
|
447
|
-
)
|
|
369
|
+
|
|
370
|
+
# Return the validated authorization type for use in the stack
|
|
371
|
+
return validated_config.authorization_type
|
|
448
372
|
|
|
449
373
|
def _setup_lambda_integration(
|
|
450
374
|
self, api_gateway, api_id, route, lambda_fn, authorizer, suffix
|
|
451
375
|
):
|
|
452
376
|
"""Setup Lambda integration for a route"""
|
|
453
|
-
import logging
|
|
454
|
-
|
|
455
377
|
route_path = route["path"]
|
|
456
|
-
|
|
378
|
+
|
|
379
|
+
# Handle authorization type fallback logic before validation
|
|
457
380
|
authorization_type = route.get("authorization_type", "COGNITO")
|
|
458
|
-
|
|
381
|
+
|
|
459
382
|
# If no Cognito authorizer available and default COGNITO, fall back to NONE
|
|
460
383
|
if (
|
|
461
384
|
not authorizer
|
|
@@ -463,14 +386,22 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
|
|
|
463
386
|
and "authorization_type" not in route
|
|
464
387
|
):
|
|
465
388
|
authorization_type = "NONE"
|
|
389
|
+
import logging
|
|
466
390
|
logger = logging.getLogger(__name__)
|
|
467
391
|
logger.info(
|
|
468
392
|
f"No Cognito authorizer available for route {route_path} ({route.get('method', 'unknown')}), "
|
|
469
393
|
f"defaulting to public access (NONE authorization)"
|
|
470
394
|
)
|
|
471
|
-
|
|
472
|
-
#
|
|
473
|
-
|
|
395
|
+
|
|
396
|
+
# Create a route config with the resolved authorization type for validation
|
|
397
|
+
route_for_validation = dict(route)
|
|
398
|
+
route_for_validation["authorization_type"] = authorization_type
|
|
399
|
+
|
|
400
|
+
# Validate authorization configuration using the utility
|
|
401
|
+
validated_authorization_type = self._validate_authorization_configuration(route_for_validation, authorizer is not None)
|
|
402
|
+
|
|
403
|
+
# Use the validated authorization type
|
|
404
|
+
authorization_type = validated_authorization_type
|
|
474
405
|
|
|
475
406
|
# If set to NONE (explicitly or by fallback), skip authorization
|
|
476
407
|
if authorization_type == "NONE":
|
|
@@ -487,6 +418,7 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
|
|
|
487
418
|
"user_pool_id": (
|
|
488
419
|
os.getenv("COGNITO_USER_POOL_ID") if authorizer else None
|
|
489
420
|
),
|
|
421
|
+
"allow_public_override": route.get("allow_public_override", False),
|
|
490
422
|
}
|
|
491
423
|
)
|
|
492
424
|
|
|
@@ -508,12 +440,11 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
|
|
|
508
440
|
self, api_gateway, route, lambda_fn, authorizer, api_id, suffix
|
|
509
441
|
):
|
|
510
442
|
"""Setup fallback Lambda integration for routes without src"""
|
|
511
|
-
import logging
|
|
512
|
-
|
|
513
443
|
route_path = route["path"]
|
|
514
|
-
|
|
444
|
+
|
|
445
|
+
# Handle authorization type fallback logic before validation
|
|
515
446
|
authorization_type = route.get("authorization_type", "COGNITO")
|
|
516
|
-
|
|
447
|
+
|
|
517
448
|
# If no Cognito authorizer available and default COGNITO, fall back to NONE
|
|
518
449
|
if (
|
|
519
450
|
not authorizer
|
|
@@ -521,14 +452,22 @@ class ApiGatewayStack(IStack, EnhancedSsmParameterMixin):
|
|
|
521
452
|
and "authorization_type" not in route
|
|
522
453
|
):
|
|
523
454
|
authorization_type = "NONE"
|
|
455
|
+
import logging
|
|
524
456
|
logger = logging.getLogger(__name__)
|
|
525
457
|
logger.info(
|
|
526
458
|
f"No Cognito authorizer available for route {route_path} ({route.get('method', 'unknown')}), "
|
|
527
459
|
f"defaulting to public access (NONE authorization)"
|
|
528
460
|
)
|
|
529
|
-
|
|
530
|
-
#
|
|
531
|
-
|
|
461
|
+
|
|
462
|
+
# Create a route config with the resolved authorization type for validation
|
|
463
|
+
route_for_validation = dict(route)
|
|
464
|
+
route_for_validation["authorization_type"] = authorization_type
|
|
465
|
+
|
|
466
|
+
# Validate authorization configuration using the utility
|
|
467
|
+
validated_authorization_type = self._validate_authorization_configuration(route_for_validation, authorizer is not None)
|
|
468
|
+
|
|
469
|
+
# Use the validated authorization type
|
|
470
|
+
authorization_type = validated_authorization_type
|
|
532
471
|
|
|
533
472
|
resource = (
|
|
534
473
|
api_gateway.root.resource_for_path(route_path)
|
|
@@ -1382,15 +1382,19 @@ class ApiGatewayIntegrationUtility:
|
|
|
1382
1382
|
modified_config = deepcopy(api_config)
|
|
1383
1383
|
|
|
1384
1384
|
auth_type = str(getattr(api_config, "authorization_type", "COGNITO")).upper()
|
|
1385
|
-
|
|
1386
|
-
# Check for explicit override flag
|
|
1387
|
-
explicit_override = (
|
|
1388
|
-
str(getattr(api_config, "allow_public_override", False)).lower() == "true"
|
|
1389
|
-
)
|
|
1390
|
-
|
|
1391
1385
|
route_path = getattr(api_config, "routes", "unknown")
|
|
1392
1386
|
method = getattr(api_config, "method", "unknown")
|
|
1387
|
+
|
|
1388
|
+
logger = logging.getLogger(__name__)
|
|
1393
1389
|
|
|
1390
|
+
# Check for explicit override flag
|
|
1391
|
+
explicit_override = getattr(api_config, "allow_public_override", False)
|
|
1392
|
+
# Handle both boolean and string values
|
|
1393
|
+
if isinstance(explicit_override, str):
|
|
1394
|
+
explicit_override = explicit_override.lower() in ("true", "1", "yes")
|
|
1395
|
+
else:
|
|
1396
|
+
explicit_override = bool(explicit_override)
|
|
1397
|
+
|
|
1394
1398
|
logger = logging.getLogger(__name__)
|
|
1395
1399
|
|
|
1396
1400
|
# Case 1: Cognito available + NONE requested + No explicit override = ERROR
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.28"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.7.27"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/enhanced_base_config.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/enhanced_ssm_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/_resources.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/api_gateway.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/auto_scaling.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/cloudfront.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/code_artifact.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/cognito.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/docker.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/dynamodb.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/exisiting.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/lambda_layers.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/load_balancer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/resource_types.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/route53.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/configurations/resources/security_group.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/lambdas/policies/policy_docs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/constructs/sqs/policies/sqs_policies.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/interfaces/enhanced_ssm_parameter_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/auto_scaling/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/aws_lambdas/lambda_stack.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/buckets/bucket_stack.py
RENAMED
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/cognito/cognito_stack.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/dynamodb/dynamodb_stack.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/load_balancer/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/route53/route53_stack.py
RENAMED
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stack_library/security_group/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/stages/websites/static_website_stage.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cdk_factory-0.7.27 → cdk_factory-0.7.28}/src/cdk_factory/utilities/lambda_function_utilities.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|