Skip to content

Commit 4f29c1d

Browse files
authored
fix: enable node-fips compatible body checksums for S3 (#31883)
### Issue # (if applicable) Internal reference: D166315367 ### Reason for this change In FIPS enabled environments, the MD5 algorithm is not available for use in crypto module. However by default the S3 client is using an MD5 checksum for content integrity checking. This causes any S3 upload operation to fail with a cryptography error. ### Description of changes We are disabling the S3 content checksums, and are re-enabling the regular SigV4 body signing. SigV4 uses SHA256 for their content checksum. This configuration matches the default behavior of the AWS SDKv3 and is a safe choice for all users. ### Description of how you validated changes For non-FIPS users, we have verified functionality via cli-integ-tests. For FIPS users, we have manually verified `cdk deploy` is now working in a FIPS enabled environment. We have also verified the configuration with the affected customer. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 886283e commit 4f29c1d

File tree

5 files changed

+43
-33
lines changed

5 files changed

+43
-33
lines changed

packages/@aws-cdk/integ-runner/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@
7474
"@aws-cdk/cloud-assembly-schema": "^38.0.0",
7575
"@aws-cdk/cloudformation-diff": "0.0.0",
7676
"@aws-cdk/cx-api": "0.0.0",
77-
"cdk-assets": "^2.154.0",
77+
"cdk-assets": "^2.155.17",
7878
"@aws-cdk/aws-service-spec": "^0.1.29",
79-
8079
"@aws-cdk/cdk-cli-wrapper": "0.0.0",
8180
"aws-cdk": "0.0.0",
8281
"chalk": "^4",

packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md

+20
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Flags come in three types:
8080
| [@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId](#aws-cdkaws-rdssetcorrectvaluefordatabaseinstancereadreplicainstanceresourceid) | When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn` | 2.161.0 | (fix) |
8181
| [@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics](#aws-cdkcorecfnincluderejectcomplexresourceupdatecreatepolicyintrinsics) | When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values. | 2.161.0 | (fix) |
8282
| [@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy](#aws-cdkaws-stepfunctions-tasksfixrunecstaskpolicy) | When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN. | 2.163.0 | (fix) |
83+
| [@aws-cdk/aws-dynamodb:resourcePolicyPerReplica](#aws-cdkaws-dynamodbresourcepolicyperreplica) | When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas | V2NEXT | (fix) |
8384

8485
<!-- END table -->
8586

@@ -143,6 +144,7 @@ The following json shows the current recommended set of flags, as `cdk init` wou
143144
"@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false,
144145
"@aws-cdk/aws-s3:keepNotificationInImportedBucket": false,
145146
"@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true,
147+
"@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": true,
146148
"@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": true,
147149
"@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": true,
148150
"@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": true,
@@ -1509,4 +1511,22 @@ When this feature flag is enabled, if the task definition is created in the stac
15091511
| 2.163.0 | `false` | `true` |
15101512

15111513

1514+
### @aws-cdk/aws-dynamodb:resourcePolicyPerReplica
1515+
1516+
*When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas* (fix)
1517+
1518+
If this flag is not set, the default behavior for `TableV2` is to use a different `resourcePolicy` for each replica.
1519+
1520+
If this flag is set to false, the behavior is that each replica shares the same `resourcePolicy` as the source table.
1521+
This will prevent you from creating a new table which has an additional replica and a resource policy.
1522+
1523+
This is a feature flag as the old behavior was technically incorrect but users may have come to depend on it.
1524+
1525+
1526+
| Since | Default | Recommended |
1527+
| ----- | ----- | ----- |
1528+
| (not in v1) | | |
1529+
| V2NEXT | `false` | `true` |
1530+
1531+
15121532
<!-- END details -->

packages/aws-cdk/lib/api/aws-auth/sdk.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,18 @@ export class SDK implements ISDK {
174174
}
175175

176176
public s3(): AWS.S3 {
177-
return this.wrapServiceErrorHandling(new AWS.S3(this.config));
177+
return this.wrapServiceErrorHandling(new AWS.S3({
178+
// In FIPS enabled environments, the MD5 algorithm is not available for use in crypto module.
179+
// However by default the S3 client is using an MD5 checksum for content integrity checking.
180+
// While this usage is technically allowed in FIPS (MD5 is only prohibited for cryptographic use),
181+
// in practice it is just easier to use an allowed checksum mechanism.
182+
// We are disabling the S3 content checksums, and are re-enabling the regular SigV4 body signing.
183+
// SigV4 uses SHA256 for their content checksum. This configuration matches the default behavior
184+
// of the AWS SDKv3 and is a safe choice for all users.
185+
s3DisableBodySigning: false,
186+
computeChecksums: false,
187+
...this.config,
188+
}));
178189
}
179190

180191
public route53(): AWS.Route53 {

packages/aws-cdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"archiver": "^5.3.2",
105105
"aws-sdk": "^2.1691.0",
106106
"camelcase": "^6.3.0",
107-
"cdk-assets": "^2.155.0",
107+
"cdk-assets": "^2.155.17",
108108
"cdk-from-cfn": "^0.162.0",
109109
"chalk": "^4",
110110
"chokidar": "^3.6.0",

yarn.lock

+9-29
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,10 @@
6767
jsonschema "^1.4.1"
6868
semver "^7.6.3"
6969

70-
"@aws-cdk/cx-api@^2.158.0":
71-
version "2.159.0"
72-
resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.159.0.tgz#567c0ae0d7a6fc2f7cb9bda7e6cb23fac8d99094"
73-
integrity sha512-HVkHCKQjVi3PCSOF22zLztZMEL+cJcyVvFctS3vXPetgl77L+e/onaGt1AUwRcNY44tvbqJm3oIVQt2HqM3q7w==
74-
dependencies:
75-
semver "^7.6.3"
76-
77-
"@aws-cdk/cx-api@^2.160.0":
78-
version "2.160.0"
79-
resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.160.0.tgz#08d4599690a39768bb944c411f1141166e313b59"
80-
integrity sha512-ujXT/UoUDquCwxJ14jkRzIFeMabMyLATWP32Jv0WJjWpxrGJCa+Lua+CByOyikC1QeSVxq8pZcrx0jjYyG0qzw==
70+
"@aws-cdk/cx-api@^2.163.1":
71+
version "2.163.1"
72+
resolved "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-2.163.1.tgz#ef55da9f471c963d877b23d3201ca4560d656b2e"
73+
integrity sha512-0bVL/pX0UcliCdXVcgtLVL3W5EHAp4RgW7JN3prz1dIOmLZzZ30DW0qWSc0D0EVE3rVG6RVgfIiuFBFK6WFZ+w==
8174
dependencies:
8275
semver "^7.6.3"
8376

@@ -6794,26 +6787,13 @@ [email protected], case@^1.6.3:
67946787
resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
67956788
integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==
67966789

6797-
cdk-assets@^2.154.0:
6798-
version "2.154.0"
6799-
resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.154.0.tgz#675d239c0156ca05c4a2809b30858c843f984ead"
6800-
integrity sha512-8M3zLHCx8nj5Fv5ubEps53jh22NN9G7ZLuq1AJwPdXZP7+nb4q5tdl2Ah2ZPMM/dob9u3KTwNeN34oLKHfDzbw==
6801-
dependencies:
6802-
"@aws-cdk/cloud-assembly-schema" "^38.0.0"
6803-
"@aws-cdk/cx-api" "^2.158.0"
6804-
archiver "^5.3.2"
6805-
aws-sdk "^2.1691.0"
6806-
glob "^7.2.3"
6807-
mime "^2.6.0"
6808-
yargs "^16.2.0"
6809-
6810-
cdk-assets@^2.155.0:
6811-
version "2.155.0"
6812-
resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.155.0.tgz#2e4f347f850c8850bcb2834807b457f41e62f1cf"
6813-
integrity sha512-wEztkIxJnQrIh93x6Qxu4MbRLROhl7NeWgasNZdCoOd6ykXsDSuL8JMi0wettbwGArnhhXMcll1m4+X4VQgzcA==
6790+
cdk-assets@^2.155.17:
6791+
version "2.155.17"
6792+
resolved "https://registry.npmjs.org/cdk-assets/-/cdk-assets-2.155.17.tgz#d6c285d0279aec8226b45577a151e6dd32a12fa5"
6793+
integrity sha512-+hJlYYlsPHhPCeMC/V3pMyrjz5K8p9SQdC50qMg6a8/w/3w0WY1ZixyKGtpJfFB11C3Ubb04l2miieaAH00CIA==
68146794
dependencies:
68156795
"@aws-cdk/cloud-assembly-schema" "^38.0.1"
6816-
"@aws-cdk/cx-api" "^2.160.0"
6796+
"@aws-cdk/cx-api" "^2.163.1"
68176797
archiver "^5.3.2"
68186798
aws-sdk "^2.1691.0"
68196799
glob "^7.2.3"

0 commit comments

Comments
 (0)