-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws_lambda: enforced code signing causes deployment failure #29474
Description
Describe the bug
While configuring code signing on an aws lambda if you specify a code signing config where the untrusted_artifact_on_deployment parameter is set to ENFORCE the deployment will always fail. If the policy is set to warn there is no problem.
test_signing_profile = signer.SigningProfile(
self,
"Test Signing Profile",
platform=signer.Platform.AWS_LAMBDA_SHA384_ECDSA,
)
test_code_signing_config = lambda_.CodeSigningConfig(
self,
"Test Code Signing Config",
signing_profiles=[
test_signing_profile,
],
description="Test",
# setting untrusted_artifact_on_deployment to ENFORCE causes deployment to fail
untrusted_artifact_on_deployment=lambda_.UntrustedArtifactOnDeployment.ENFORCE,
)
test_lambda = lambda_.Function(
self,
"Test Lambda",
runtime=lambda_.Runtime.PYTHON_3_12,
handler="lambda_function.lambda_handler",
code_signing_config=test_code_signing_config,
code=lambda_.Code.from_asset(
"lambda/api/websocket/test",
),
timeout=Duration.seconds(15),
memory_size=256,
architecture=lambda_.Architecture.X86_64,
retry_attempts=0,
description="Test Lambda delete later.",
initial_policy=[],
)Expected Behavior
The lambda to be signed using the code signing configuration
Current Behavior
The code fails to deploy with an error message: Lambda cannot deploy the function. The function or layer might be signed using a signature that the client is not configured to accept. Check the provided signature for LAMBDA_ARN_HERE
Reproduction Steps
Create a stack with the above resources, try to deploy a lambda with warn, it will work. Try to deploy the lambda with enforce, it will not work
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.132.1
Framework Version
No response
Node.js Version
v20.11.1
OS
Ubuntu 23.10
Language
Python
Language Version
Python 3.11
Other information
No response