Skip to content

Commit 47b5ca0

Browse files
rix0rrrMrArnoldPalmer
authored andcommitted
fix(pipelines): 'ConfirmPermissionsBroadening' uses wrong node version (#20861)
The CodeBuild Project that is used when the `ConfirmPermissionsBroadening` feature is enabled does not have a CodeBuild image specified. This makes it use the `standard:2.0` image by default, which is AL2-based and comes with Node 12. CDK tooling now requires Node 14 to run. Make it use the `standard:5.0` image like all other CodeBuild projects, which contains Node 14. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 47d7ec4 commit 47b5ca0

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

packages/@aws-cdk/pipelines/lib/private/application-security-check.ts

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ export class ApplicationSecurityCheck extends Construct {
9999
` --message "${message.join('\n')}"`;
100100

101101
this.cdkDiffProject = new codebuild.Project(this, 'CDKSecurityCheck', {
102+
environment: {
103+
buildImage: codebuild.LinuxBuildImage.STANDARD_5_0,
104+
},
102105
buildSpec: codebuild.BuildSpec.fromObject({
103106
version: 0.2,
104107
phases: {

packages/@aws-cdk/pipelines/test/compliance/security-check.test.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ behavior('security check option generates lambda/codebuild at pipeline scope', (
4040
});
4141

4242
function THEN_codePipelineExpectation() {
43-
Template.fromStack(pipelineStack).resourceCountIs('AWS::Lambda::Function', 1);
44-
Template.fromStack(pipelineStack).hasResourceProperties('AWS::Lambda::Function', {
43+
const template = Template.fromStack(pipelineStack);
44+
template.resourceCountIs('AWS::Lambda::Function', 1);
45+
template.hasResourceProperties('AWS::Lambda::Function', {
4546
Role: {
4647
'Fn::GetAtt': [
4748
stringLike('CdkPipeline*SecurityCheckCDKPipelinesAutoApproveServiceRole*'),
@@ -50,7 +51,17 @@ behavior('security check option generates lambda/codebuild at pipeline scope', (
5051
},
5152
});
5253
// 1 for github build, 1 for synth stage, and 1 for the application security check
53-
Template.fromStack(pipelineStack).resourceCountIs('AWS::CodeBuild::Project', 3);
54+
template.resourceCountIs('AWS::CodeBuild::Project', 3);
55+
56+
// No CodeBuild project has a build image that is not standard:5.0
57+
const projects = template.findResources('AWS::CodeBuild::Project', {
58+
Properties: {
59+
Environment: {
60+
Image: 'aws/codebuild/standard:5.0',
61+
},
62+
},
63+
});
64+
expect(Object.keys(projects).length).toEqual(3);
5465
}
5566
});
5667

packages/@aws-cdk/pipelines/test/pipeline-security.integ.snapshot/PipelineSecurityStack.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
}
2828
}
2929
},
30-
"89f6e045568a0cd52d21d8215bb87ce0d05485ee8c757b0eb4ac080ddc9f1d6f": {
30+
"7f17b1fbdb3783f2f992a94602a37c674f58741617a65f348b43ba1a7637a115": {
3131
"source": {
3232
"path": "PipelineSecurityStack.template.json",
3333
"packaging": "file"
3434
},
3535
"destinations": {
3636
"current_account-current_region": {
3737
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
38-
"objectKey": "89f6e045568a0cd52d21d8215bb87ce0d05485ee8c757b0eb4ac080ddc9f1d6f.json",
38+
"objectKey": "7f17b1fbdb3783f2f992a94602a37c674f58741617a65f348b43ba1a7637a115.json",
3939
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
4040
}
4141
}

packages/@aws-cdk/pipelines/test/pipeline-security.integ.snapshot/PipelineSecurityStack.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2603,7 +2603,7 @@
26032603
},
26042604
"Environment": {
26052605
"ComputeType": "BUILD_GENERAL1_SMALL",
2606-
"Image": "aws/codebuild/standard:1.0",
2606+
"Image": "aws/codebuild/standard:5.0",
26072607
"ImagePullCredentialsType": "CODEBUILD",
26082608
"PrivilegedMode": false,
26092609
"Type": "LINUX_CONTAINER"
@@ -2947,7 +2947,7 @@
29472947
},
29482948
"Environment": {
29492949
"ComputeType": "BUILD_GENERAL1_SMALL",
2950-
"Image": "aws/codebuild/standard:1.0",
2950+
"Image": "aws/codebuild/standard:5.0",
29512951
"ImagePullCredentialsType": "CODEBUILD",
29522952
"PrivilegedMode": false,
29532953
"Type": "LINUX_CONTAINER"

packages/@aws-cdk/pipelines/test/pipeline-security.integ.snapshot/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"validateOnSynth": false,
6666
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
6767
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
68-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/89f6e045568a0cd52d21d8215bb87ce0d05485ee8c757b0eb4ac080ddc9f1d6f.json",
68+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7f17b1fbdb3783f2f992a94602a37c674f58741617a65f348b43ba1a7637a115.json",
6969
"requiresBootstrapStackVersion": 6,
7070
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
7171
"additionalDependencies": [

packages/@aws-cdk/pipelines/test/pipeline-security.integ.snapshot/tree.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
"attributes": {
269269
"aws:cdk:cloudformation:type": "AWS::KMS::Alias",
270270
"aws:cdk:cloudformation:props": {
271-
"aliasName": "alias/codepipeline-pipelinesecuritystacktestpipelinef7060861",
271+
"aliasName": "alias/codepipeline-pipelinesecuritystack-testpipeline-f7060861",
272272
"targetKeyId": {
273273
"Fn::GetAtt": [
274274
"TestPipelineArtifactsBucketEncryptionKey13258842",
@@ -3519,7 +3519,7 @@
35193519
},
35203520
"environment": {
35213521
"type": "LINUX_CONTAINER",
3522-
"image": "aws/codebuild/standard:1.0",
3522+
"image": "aws/codebuild/standard:5.0",
35233523
"imagePullCredentialsType": "CODEBUILD",
35243524
"privilegedMode": false,
35253525
"computeType": "BUILD_GENERAL1_SMALL"
@@ -4065,7 +4065,7 @@
40654065
},
40664066
"environment": {
40674067
"type": "LINUX_CONTAINER",
4068-
"image": "aws/codebuild/standard:1.0",
4068+
"image": "aws/codebuild/standard:5.0",
40694069
"imagePullCredentialsType": "CODEBUILD",
40704070
"privilegedMode": false,
40714071
"computeType": "BUILD_GENERAL1_SMALL"

0 commit comments

Comments
 (0)